Exemple #1
0
        private static void OnSetCommandParameterCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
        {
            XamDataTree menuItem = dependencyObject as XamDataTree;

            if (menuItem != null)
            {
                XamDataTreeNodeActivatedCommandBehavior behavior = GetOrCreateBehavior(menuItem);
                behavior.CommandParameter = e.NewValue;
            }
        }
Exemple #2
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);
        }