public override void OnApplyTemplate() { base.OnApplyTemplate(); this.root = this.GetTemplateChild(ElementRoot) as FrameworkElement; this.addButton = this.GetTemplateChild(ElementAddButton) as Button; this.removeButton = this.GetTemplateChild(ElementRemoveButton) as Button; this.dataTree = this.GetTemplateChild(ElementTreeGrid) as TreeDataGrid; this.addButton.Click += new RoutedEventHandler(this.OnAddButtonClicked); if (this.dataTree != null) { this.InitGrid(); } }
public override void OnApplyTemplate() { base.OnApplyTemplate(); this.root = this.GetTemplateChild(ElementRoot) as FrameworkElement; this.newButton = this.GetTemplateChild(ElementNewButton) as Button; this.openButton = this.GetTemplateChild(ElementOpenButton) as Button; this.deleteButton = this.GetTemplateChild(ElementDeleteButton) as Button; this.treeGrid = this.GetTemplateChild(ElementTreeGrid) as TreeDataGrid; if (this.treeGrid != null) { this.treeGrid.Init(relatedModel, null); } if (this.openButton != null) { this.openButton.Click += new RoutedEventHandler(this.OnOpenButtonClicked); } }