static void OnServiceProviderChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) { LayoutTabControl control = obj as LayoutTabControl; if (control != null) { if (control.ServiceProvider != null) { control.window = control.ServiceProvider.GetService(typeof(ToolsUIWindow)) as ToolsUIWindow; } else { control.window = null; } } }
static void OnActiveContentChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) { LayoutTabControl ctrl = obj as LayoutTabControl; if (ctrl != null) { ctrl.RaiseEvent(new RoutedEventArgs(ActiveContentChangedEvent)); if (ctrl.SelectedIndex >= 0) { var tabItem = ctrl.ItemContainerGenerator.ContainerFromIndex(ctrl.SelectedIndex) as TabItem; if (tabItem != null && tabItem.Content is IActivationSite) { ((IActivationSite)tabItem.Content).TunnelActivation(); } } } }
public override void OnApplyTemplate() { base.OnApplyTemplate(); this.tabControl = GetTemplateChild("PART_LayoutTabControl") as LayoutTabControl; this.viewList = GetTemplateChild("PART_ViewListBox") as ViewListBox; if (this.tabControl == null || this.viewList == null) { throw new InvalidOperationException("ViewLayoutEditor template is not correct."); } this.viewList.ListBoxButtonDownAction = OnListBoxItemLeftButtonDown; this.Dispatcher.BeginInvoke((Action)(() => { OnCurrentLayoutDefinitionForEditChanged(); }), DispatcherPriority.Background); var window = this.FindParent <ToolsUIWindow>(); if (window != null) { this.SetBinding(CurrentLayoutDefinitionForEditProperty, new Binding { Source = window, Path = new PropertyPath(ToolsUIWindow.CurrentLayoutDefinitionForEditProperty) }); } }
public LayoutTabControlAutomationPeer(LayoutTabControl owner) : base(owner) { this.owner = owner; }
public override void OnApplyTemplate() { base.OnApplyTemplate(); this.tabControl = GetTemplateChild("PART_LayoutTabControl") as LayoutTabControl; this.viewList = GetTemplateChild("PART_ViewListBox") as ViewListBox; if (this.tabControl == null || this.viewList == null) { throw new InvalidOperationException("ViewLayoutEditor template is not correct."); } this.viewList.ListBoxButtonDownAction = OnListBoxItemLeftButtonDown; this.Dispatcher.BeginInvoke((Action)(() => { OnCurrentLayoutDefinitionForEditChanged(); }), DispatcherPriority.Background); var window = this.FindParent<ToolsUIWindow>(); if (window != null) { this.SetBinding(CurrentLayoutDefinitionForEditProperty, new Binding { Source = window, Path = new PropertyPath(ToolsUIWindow.CurrentLayoutDefinitionForEditProperty) }); } }