Example #1
0
        public PropertyGrid()
        {
            _properties         = new PropertyItemCollection(new ObservableCollection <PropertyItem>());
            EditorDefinitions   = new EditorDefinitionCollection();
            PropertyDefinitions = new PropertyDefinitionCollection();

            AddHandler(PropertyItem.ItemSelectionChangedEvent, new RoutedEventHandler(OnItemSelectionChanged));
            AddHandler(PropertyItem.ItemOrderingChangedEvent, new RoutedEventHandler(OnItemOrderingChanged));
            CommandBindings.Add(new CommandBinding(PropertyGridCommands.ClearFilter, ClearFilter, CanClearFilter));
        }
        public PropertyGrid()
        {
            _propertyDefinitionsListener = new WeakEventListener <NotifyCollectionChangedEventArgs>(this.OnPropertyDefinitionsCollectionChanged);
            _editorDefinitionsListener   = new WeakEventListener <NotifyCollectionChangedEventArgs>(this.OnEditorDefinitionsCollectionChanged);
            UpdateContainerHelper();
            EditorDefinitions   = new EditorDefinitionCollection();
            PropertyDefinitions = new PropertyDefinitionCollection();

            AddHandler(PropertyItemBase.ItemSelectionChangedEvent, new RoutedEventHandler(OnItemSelectionChanged));
            AddHandler(PropertyItemsControl.PreparePropertyItemEvent, new PropertyItemEventHandler(OnPreparePropertyItemInternal));
            AddHandler(PropertyItemsControl.ClearPropertyItemEvent, new PropertyItemEventHandler(OnClearPropertyItemInternal));
            CommandBindings.Add(new CommandBinding(PropertyGridCommands.ClearFilter, ClearFilter, CanClearFilter));
        }
        protected virtual void OnPropertyDefinitionsChanged(PropertyDefinitionCollection oldValue, PropertyDefinitionCollection newValue)
        {
            if (oldValue != null)
            {
                CollectionChangedEventManager.RemoveListener(oldValue, _propertyDefinitionsListener);
            }

            if (newValue != null)
            {
                CollectionChangedEventManager.AddListener(newValue, _propertyDefinitionsListener);
            }

            this.Notify(this.PropertyChanged, () => this.PropertyDefinitions);
        }
Example #4
0
        protected virtual void OnPropertyDefinitionsChanged(PropertyDefinitionCollection oldValue, PropertyDefinitionCollection newValue)
        {
            if (oldValue != null)
            {
                oldValue.CollectionChanged -= new NotifyCollectionChangedEventHandler(OnPropertyDefinitionsCollectionChanged);
            }

            if (newValue != null)
            {
                newValue.CollectionChanged += new NotifyCollectionChangedEventHandler(OnPropertyDefinitionsCollectionChanged);
            }

            UpdateProperties(true);
        }
Example #5
0
 public PropertyGrid()
 {
     EditorDefinitions   = new EditorDefinitionCollection();
     PropertyDefinitions = new PropertyDefinitionCollection();
     CommandBindings.Add(new CommandBinding(PropertyGridCommands.ClearFilter, ClearFilter, CanClearFilter));
 }