void IHandle <WaitEvent> .Handle(WaitEvent message) { // отбрасываем чужие сообщения //NOTE: позже можно сделать специальный поиск по вложенным элементам if (message.Sender != Content && (!(Content is IView) || message.Sender != ((IView)Content).DataContext)) { return; } switch (message.Type) { case WaitEventType.Start: if (_captionTemplateWait != null && !_captionTemplateWait.Equals(CaptionTemplate)) { CaptionTemplate = _captionTemplateWait; } break; case WaitEventType.Stop: //CaptionTemplate = null; if (_captionTemplate != null && !_captionTemplate.Equals(CaptionTemplate)) { CaptionTemplate = _captionTemplate; } break; } }
private void SetDropDownContentTemplate() { if (this.isTemplateApplied == true) { DataTemplate template = null; if (this.DropDownContentTemplateSelector != null) { template = this.DropDownContentTemplateSelector.SelectTemplate(this.DropDownContent, this); } if (template == null) { template = this.DropDownContentTemplate; } if (template != null) { DependencyObject element = this.GetTemplateChild("DropDownPopupContent"); ContentPresenter dropDownContentElement = element as ContentPresenter; if (dropDownContentElement != null && !template.Equals(dropDownContentElement.ContentTemplate)) { dropDownContentElement.ContentTemplate = template; } } } }