void OnContentTemplateChanged(AbstractProperty property, object oldValue) { if (ContentTemplate == null) { InstallAutomaticContentDataTemplate(); return; } SetTemplateControl(ContentTemplate.LoadContent(this) as FrameworkElement); }
public void DoTransition(object newContent, ITransition transition) { if (newContent == null) { Children.Clear(); return; } UIElement view; if (ContentTemplate != null) { var template = ContentTemplate.LoadContent(); var fe = template as FrameworkElement; if (fe != null) { fe.DataContext = newContent; } view = template as UIElement; } else { view = newContent as UIElement; } if (view == null) { return; } if (Children.Count > 0) { if (transition.RequiresNewContentTopmost) { Children.Add(view); transition.BeginTransition(this, Children[0], view); } else { Children.Insert(0, view); transition.BeginTransition(this, Children[1], view); } } else { Children.Add(view); TransitionEnded(transition, null, view); } }
private void UpdateContentTemplate() { Child = ContentTemplate?.LoadContent() as UIElement; if (Child == null) { return; } this.textBox = ((FrameworkElement)Child)?.FindName("entry") as TextBoxEx; if (this.textBox == null) { throw new InvalidOperationException("Need an entry TextBoxEx for EntryPopup"); } }
public override void OnApplyTemplate() { GoToState(Drawing); base.OnApplyTemplate(); ReSize(); var content = (ContentControl)GetTemplateChild("Content"); content.Content = ContentTemplate.LoadContent(); var headerContent = (ContentControl)GetTemplateChild("HeaderContent"); headerContent.Content = HeaderTemplate.LoadContent(); headerContent.MouseLeftButtonUp += HeaderContentMouseLeftButtonUp; headerContent.MouseEnter += UniformItemMouseEnter; headerContent.MouseLeave += UniformItemMouseLeave; }