Exemplo n.º 1
0
        static void OnSelectedItemChanged(Control sender, AttachedPropertyChangedEventArgs<object> e)
        {
            IItemsSourceFeature feature = sender.GetItemsSourceFeature();
            if(feature != null) {
                Action<Control> selectionChangedHandler = sender.GetValue(HandlerProperty);
                if(selectionChangedHandler == null) {
                    selectionChangedHandler = OnSelectionChanged;
                    sender.SetValue(HandlerProperty, selectionChangedHandler);
                    feature.AddSelectionChangedCallback(sender, selectionChangedHandler);
                }

                feature.SetSelectedItem(sender, e.NewValue);
                sender.SetSelectedItem(feature.GetSelectedItem(sender));
                //TODO test recursion or add assert
            }
        }
Exemplo n.º 2
0
 public static object GetValue(Control control, string property)
 {
     return control.GetValue(property, true);
 }