예제 #1
0
 private static void OnSetCommandParameterCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
 {
     Controls.LoadingListBox ctrl = dependencyObject as Controls.LoadingListBox;
     if (ctrl != null)
     {
         NeedItemsCommandBehavior behavior = GetOrCreateBehavior(ctrl);
         behavior.CommandParameter = e.NewValue;
     }
 }
예제 #2
0
        private static NeedItemsCommandBehavior GetOrCreateBehavior(Controls.LoadingListBox ctrl)
        {
            NeedItemsCommandBehavior behavior = ctrl.GetValue(NeedItemsCommandBehaviorProperty) as NeedItemsCommandBehavior;

            if (behavior == null)
            {
                behavior = new NeedItemsCommandBehavior(ctrl);
                ctrl.SetValue(NeedItemsCommandBehaviorProperty, behavior);
            }

            return(behavior);
        }