private static void CommandProperty_Changed(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e) { Selector element = dependencyObject as Selector; if (element != null) { MultiSelectionChangedBehavior behavior = GetOrCreateBehavior(element); behavior.Command = e.NewValue as ICommand; } }
private static MultiSelectionChangedBehavior GetOrCreateBehavior(Selector element) { MultiSelectionChangedBehavior behavior = element.GetValue(MultiSelectionChangedBehaviourProperty) as MultiSelectionChangedBehavior; if (behavior == null) { behavior = new MultiSelectionChangedBehavior(element); element.SetValue(MultiSelectionChangedBehaviourProperty, behavior); } return(behavior); }
public static void SetMultiSelectionChangedCommandBehavior(DependencyObject obj, MultiSelectionChangedBehavior value) { obj.SetValue(MultiSelectionChangedBehaviourProperty, value); }