public static void SetHasBindableSelectedItems(ListBox source, bool value)
 {
     SelectionChangedHandler Handler = (SelectionChangedHandler)source.GetValue(SelectionChangedHandlerProperty);
     if (value && Handler == null)
     {
         Handler = new SelectionChangedHandler(source);
         source.SetValue(SelectionChangedHandlerProperty, Handler);
     }
     else if (!value && Handler != null)
     { source.ClearValue(SelectionChangedHandlerProperty); }
 }
        public static void SetHasBindableSelectedItems(ListBox source, bool value)
        {
            SelectionChangedHandler Handler = (SelectionChangedHandler)source.GetValue(SelectionChangedHandlerProperty);

            if (value && Handler == null)
            {
                Handler = new SelectionChangedHandler(source);
                source.SetValue(SelectionChangedHandlerProperty, Handler);
            }
            else if (!value && Handler != null)
            {
                source.ClearValue(SelectionChangedHandlerProperty);
            }
        }