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 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) }); } }