private static XamDataTreeCommandBehavior GetOrCreateCommandBehavior(XamDataTree menuItem) { if (!(menuItem.GetValue(SelectedCommandBehaviorProperty) is XamDataTreeCommandBehavior behavior)) { behavior = new XamDataTreeCommandBehavior(menuItem); menuItem.SetValue(SelectedCommandBehaviorProperty, behavior); } return(behavior); }
private static XamDataTreeNodeUnselectedCommandBehavior GetOrCreateBehavior(XamDataTree tree) { XamDataTreeNodeUnselectedCommandBehavior behavior = tree.GetValue(DataItemUnselectedProperty) as XamDataTreeNodeUnselectedCommandBehavior; if (behavior == null) { behavior = new XamDataTreeNodeUnselectedCommandBehavior(tree); tree.SetValue(DataItemUnselectedProperty, behavior); } return(behavior); }
private static XamDataTreeNodeActivatedCommandBehavior GetOrCreateBehavior(XamDataTree menuItem) { XamDataTreeNodeActivatedCommandBehavior behavior = menuItem.GetValue(SelectedCommandBehaviorProperty) as XamDataTreeNodeActivatedCommandBehavior; if (behavior == null) { behavior = new XamDataTreeNodeActivatedCommandBehavior(menuItem); menuItem.SetValue(SelectedCommandBehaviorProperty, behavior); } return(behavior); }
private static void Tree_Loaded(object sender, RoutedEventArgs e) { XamDataTree tree = (XamDataTree)sender; tree.Loaded -= Tree_Loaded; var node = FindTreeNodeFromDataItem(tree, tree.GetValue(DefaultSelectedDataItemProperty)); if (node != null) { if (!node.IsSelected) { node.IsSelected = true; node.IsActive = true; } } }
public static string GetDefaultSelectedDataItem(XamDataTree tree) { return(tree.GetValue(DefaultSelectedDataItemProperty) as string); }
public static object GetCommandParameter(XamDataTree menuItem) { return(menuItem.GetValue(CommandParameterProperty)); }
public static ICommand GetCommand(XamDataTree menuItem) { return(menuItem.GetValue(CommandProperty) as ICommand); }
public static object GetCommandParameter(XamDataTree tree) { return(tree.GetValue(CommandParameterProperty)); }
public static ICommand GetCommand(XamDataTree tree) { return(tree.GetValue(CommandProperty) as ICommand); }