protected override DependencyObject GetContainerForItemOverride() { var tvi = new PromptTreeViewItem(); var expandedBinding = new Binding("IsExpanded") { Mode = BindingMode.TwoWay }; tvi.SetBinding(TreeViewItem.IsExpandedProperty, expandedBinding); var isEnabledBinding = new Binding("IsEnabled") { Mode = BindingMode.OneWay }; tvi.SetBinding(IsEnabledProperty, isEnabledBinding); var isSelectedBinding = new Binding("IsSelected") { Mode = BindingMode.TwoWay }; tvi.SetBinding(PromptTreeViewItem.IsSelected2Property, isSelectedBinding); tvi.ParentTreeView = this; _treeItems.Add(tvi); return(tvi); }
protected override DependencyObject GetContainerForItemOverride() { var tvi = new PromptTreeViewItem(); var expandedBinding = new Binding("IsExpanded") { Mode = BindingMode.TwoWay }; tvi.SetBinding(TreeViewItem.IsExpandedProperty, expandedBinding); var isEnabledBinding = new Binding("IsEnabled") { Mode = BindingMode.OneWay }; tvi.SetBinding(IsEnabledProperty, isEnabledBinding); var isSelectedBinding = new Binding("IsSelected") { Mode = BindingMode.TwoWay }; tvi.SetBinding(PromptTreeViewItem.IsSelected2Property, isSelectedBinding); tvi.ParentTreeView = this; _treeItems.Add(tvi); return tvi; }