private static XamDataTreeCommandBehavior GetOrCreateCommandBehavior(XamDataTree menuItem)
 {
     if (!(menuItem.GetValue(SelectedCommandBehaviorProperty) is XamDataTreeCommandBehavior behavior))
     {
         behavior = new XamDataTreeCommandBehavior(menuItem);
         menuItem.SetValue(SelectedCommandBehaviorProperty, behavior);
     }
     return(behavior);
 }
示例#2
0
        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);
        }
示例#3
0
        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);
        }
示例#4
0
        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;
                }
            }
        }
示例#5
0
 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);
 }
示例#8
0
 public static object GetCommandParameter(XamDataTree tree)
 {
     return(tree.GetValue(CommandParameterProperty));
 }
示例#9
0
 public static ICommand GetCommand(XamDataTree tree)
 {
     return(tree.GetValue(CommandProperty) as ICommand);
 }