private static void OnSetCommandParameterCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e) { System.Windows.Controls.ListView element = dependencyObject as System.Windows.Controls.ListView; if (element != null) { SelectionChangeBehavior behavior = GetOrCreateBehavior(element); behavior.CommandParameter = e.NewValue; } }
private static SelectionChangeBehavior GetOrCreateBehavior(System.Windows.Controls.ListView element) { SelectionChangeBehavior behavior = element.GetValue(ClickBehaviorProperty) as SelectionChangeBehavior; if (behavior == null) { behavior = new SelectionChangeBehavior(element); element.SetValue(ClickBehaviorProperty, behavior); } return(behavior); }
public static void SetClickBehavior(DependencyObject obj, SelectionChangeBehavior value) { obj.SetValue(ClickBehaviorProperty, value); }