private static void OnCommandParameterChangeCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) { XamDataTree menuItem = d as XamDataTree; if (menuItem != null) { XamDataTreeCommandBehavior behavior = GetOrCreateCommandBehavior(menuItem); behavior.CommandParameter = e.NewValue; } }
private static XamDataTreeCommandBehavior GetOrCreateCommandBehavior(XamDataTree menuItem) { XamDataTreeCommandBehavior behavior = menuItem.GetValue(SelectedCommandBehaviorProperty) as XamDataTreeCommandBehavior; if (behavior == null) { behavior = new XamDataTreeCommandBehavior(menuItem); menuItem.SetValue(SelectedCommandBehaviorProperty, behavior); } return(behavior); }