Ejemplo n.º 1
0
        public virtual void PrepareChildrenPropertyItem(PropertyItemBase propertyItem, object item)
        {
            // Initialize the parent node
            propertyItem.ParentNode = PropertyContainer;

            PropertyGrid.RaisePreparePropertyItemEvent((UIElement)PropertyContainer, propertyItem, item);
        }
Ejemplo n.º 2
0
        public override Binding CreateChildrenDefaultBinding(PropertyItemBase propertyItem)
        {
            Binding binding = new Binding("Value");

            binding.Mode = (((PropertyItem)propertyItem).IsReadOnly) ? BindingMode.OneWay : BindingMode.TwoWay;
            return(binding);
        }
Ejemplo n.º 3
0
        private static void OnIsSelectedChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
        {
            PropertyItemBase propertyItem = o as PropertyItemBase;

            if (propertyItem != null)
            {
                propertyItem.OnIsSelectedChanged((bool)e.OldValue, (bool)e.NewValue);
            }
        }
Ejemplo n.º 4
0
        public override void ClearChildrenPropertyItem(PropertyItemBase propertyItem, object item)
        {
            if (propertyItem.Editor != null &&
                ContainerHelperBase.GetIsGenerated(propertyItem.Editor))
            {
                propertyItem.Editor = null;
            }

            base.ClearChildrenPropertyItem(propertyItem, item);
        }
Ejemplo n.º 5
0
        public override object ItemFromContainer(PropertyItemBase container)
        {
            // Since this call is only used to update the PropertyGrid.SelectedProperty property,
            // return the PropertyName.
            var propertyItem = container as PropertyItem;

            if (propertyItem == null)
            {
                return(null);
            }

            return(propertyItem.PropertyDescriptor.Name);
        }
Ejemplo n.º 6
0
        protected virtual void OnSelectedPropertyItemChanged(PropertyItemBase oldValue, PropertyItemBase newValue)
        {
            if (oldValue != null)
            {
                oldValue.IsSelected = false;
            }

            if (newValue != null)
            {
                newValue.IsSelected = true;
            }

            this.SelectedProperty = (newValue != null) ? _containerHelper.ItemFromContainer(newValue) : null;

            RaiseEvent(new RoutedPropertyChangedEventArgs <PropertyItemBase>(oldValue, newValue, PropertyGrid.SelectedPropertyItemChangedEvent));
        }
Ejemplo n.º 7
0
        private void OnItemSelectionChanged(object sender, RoutedEventArgs args)
        {
            PropertyItemBase item = (PropertyItemBase)args.OriginalSource;

            if (item.IsSelected)
            {
                SelectedPropertyItem = item;
            }
            else
            {
                if (object.ReferenceEquals(item, SelectedPropertyItem))
                {
                    SelectedPropertyItem = null;
                }
            }
        }
Ejemplo n.º 8
0
        public override void PrepareChildrenPropertyItem(PropertyItemBase propertyItem, object item)
        {
            _isPreparingItemFlag = true;
            base.PrepareChildrenPropertyItem(propertyItem, item);

            if (propertyItem.Editor == null)
            {
                FrameworkElement editor = this.GenerateChildrenEditorElement((PropertyItem)propertyItem);
                if (editor != null)
                {
                    // Tag the editor as generated to know if we should clear it.
                    ContainerHelperBase.SetIsGenerated(editor, true);
                    propertyItem.Editor = editor;
                }
            }
            _isPreparingItemFlag = false;
        }
Ejemplo n.º 9
0
 public abstract Binding CreateChildrenDefaultBinding(PropertyItemBase propertyItem);
Ejemplo n.º 10
0
 public abstract object ItemFromContainer(PropertyItemBase container);
Ejemplo n.º 11
0
 protected FrameworkElement CreateCustomEditor(EditorDefinitionBase customEditor, PropertyItemBase propertyItem)
 {
     return((customEditor != null)
       ? customEditor.GenerateEditingElementInternal(propertyItem)
       : null);
 }
Ejemplo n.º 12
0
 protected FrameworkElement GenerateCustomEditingElement(object definitionKey, PropertyItemBase propertyItem)
 {
     return((PropertyContainer.EditorDefinitions != null)
       ? this.CreateCustomEditor(PropertyContainer.EditorDefinitions[definitionKey], propertyItem)
       : null);
 }
Ejemplo n.º 13
0
 protected FrameworkElement GenerateCustomEditingElement(Type definitionKey, PropertyItemBase propertyItem)
 {
     return((PropertyContainer.EditorDefinitions != null)
       ? this.CreateCustomEditor(PropertyContainer.EditorDefinitions.GetRecursiveBaseTypes(definitionKey), propertyItem)
       : null);
 }
Ejemplo n.º 14
0
        public virtual void ClearChildrenPropertyItem(PropertyItemBase propertyItem, object item)
        {
            propertyItem.ParentNode = null;

            PropertyGrid.RaiseClearPropertyItemEvent((UIElement)PropertyContainer, propertyItem, item);
        }
Ejemplo n.º 15
0
 private void RaiseClearPropertyItemEvent(PropertyItemBase propertyItem, object item)
 {
     this.RaiseEvent(new PropertyItemEventArgs(PropertyItemsControl.ClearPropertyItemEvent, this, propertyItem, item));
 }
Ejemplo n.º 16
0
 public PropertyItemEventArgs(RoutedEvent routedEvent, object source, PropertyItemBase propertyItem, object item)
     : base(routedEvent, source)
 {
     this.PropertyItem = propertyItem;
     this.Item         = item;
 }
Ejemplo n.º 17
0
 internal static void RaiseClearPropertyItemEvent(UIElement source, PropertyItemBase propertyItem, object item)
 {
     source.RaiseEvent(new PropertyItemEventArgs(PropertyGrid.ClearPropertyItemEvent, source, propertyItem, item));
 }