Ejemplo n.º 1
0
        private static void CommandProperty_Changed(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
        {
            Selector element = dependencyObject as Selector;

            if (element != null)
            {
                SelectionChangedBehavior behavior = GetOrCreateBehavior(element);
                behavior.Command = e.NewValue as ICommand;
            }
        }
Ejemplo n.º 2
0
        private static SelectionChangedBehavior GetOrCreateBehavior(Selector element)
        {
            SelectionChangedBehavior behavior = element.GetValue(SelectionChangedBehaviourProperty) as SelectionChangedBehavior;

            if (behavior == null)
            {
                behavior = new SelectionChangedBehavior(element);
                element.SetValue(SelectionChangedBehaviourProperty, behavior);
            }

            return(behavior);
        }
Ejemplo n.º 3
0
 public static void SetSelectionChangedBehavior(DependencyObject obj,
                                                SelectionChangedBehavior value)
 {
     obj.SetValue(SelectionChangedBehaviourProperty, value);
 }