public override Binding CreateChildrenDefaultBinding(PropertyItemBase propertyItem)
        {
            Binding binding = new Binding("Value");

            binding.Mode = ((( PropertyItem )propertyItem).IsReadOnly) ? BindingMode.OneWay : BindingMode.TwoWay;
            return(binding);
        }
Ejemplo n.º 2
0
        public virtual void PrepareChildrenPropertyItem(PropertyItemBase propertyItem, object item)
        {
            // Initialize the parent node
            propertyItem.ParentNode = PropertyContainer;

            PropertyGrid.RaisePreparePropertyItemEvent(( UIElement )PropertyContainer, propertyItem, item);
        }
        private static void OnEditorChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
        {
            PropertyItemBase propertyItem = o as PropertyItemBase;

            if (propertyItem != null)
            {
                propertyItem.OnEditorChanged(( FrameworkElement )e.OldValue, ( FrameworkElement )e.NewValue);
            }
        }
        private static void OnIsSelectedChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
        {
            PropertyItemBase propertyItem = o as PropertyItemBase;

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

            base.ClearChildrenPropertyItem(propertyItem, item);
        }
        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.º 7
0
        protected FrameworkElement GenerateCustomEditingElement(Type definitionKey, PropertyItemBase propertyItem)
        {
            FrameworkElement editor = null;

            if (PropertyContainer.EditorDefinitions != null)
            {
                // If no editor for the current type, fall back on base type editor recursively.
                while (editor == null && definitionKey != null)
                {
                    editor        = this.CreateCustomEditor(PropertyContainer.EditorDefinitions[definitionKey], propertyItem);
                    definitionKey = definitionKey.BaseType;
                }
            }

            return(editor);
        }
Ejemplo n.º 8
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.º 9
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;
                }
            }
        }
        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.º 11
0
 protected virtual FrameworkElement GenerateEditingElement(PropertyItemBase propertyItem)
 {
     return(null);
 }
 private void RaiseClearPropertyItemEvent(PropertyItemBase propertyItem, object item)
 {
     this.RaiseEvent(new PropertyItemEventArgs(PropertyItemsControl.ClearPropertyItemEvent, this, propertyItem, item));
 }
Ejemplo n.º 13
0
        public virtual void ClearChildrenPropertyItem(PropertyItemBase propertyItem, object item)
        {
            propertyItem.ParentNode = null;

            PropertyGrid.RaiseClearPropertyItemEvent(( UIElement )PropertyContainer, propertyItem, item);
        }
Ejemplo n.º 14
0
 protected FrameworkElement GenerateCustomEditingElement(Type definitionKey, PropertyItemBase propertyItem)
 {
     return((PropertyContainer.EditorDefinitions != null)
 ? this.CreateCustomEditor(PropertyContainer.EditorDefinitions.GetRecursiveBaseTypes(definitionKey), propertyItem)
 : null);
 }
Ejemplo n.º 15
0
 protected FrameworkElement GenerateCustomEditingElement(object definitionKey, PropertyItemBase propertyItem)
 {
     return((PropertyContainer.EditorDefinitions != null)
 ? this.CreateCustomEditor(PropertyContainer.EditorDefinitions[definitionKey], propertyItem)
 : null);
 }
Ejemplo n.º 16
0
 internal static void RaiseClearPropertyItemEvent(UIElement source, PropertyItemBase propertyItem, object item)
 {
     source.RaiseEvent(new PropertyItemEventArgs(PropertyGrid.ClearPropertyItemEvent, source, propertyItem, item));
 }
Ejemplo n.º 17
0
 public PropertyItemEventArgs(RoutedEvent routedEvent, object source, PropertyItemBase propertyItem, object item)
     : base(routedEvent, source)
 {
     this.PropertyItem = propertyItem;
     this.Item         = item;
 }
 protected override sealed FrameworkElement GenerateEditingElement(PropertyItemBase propertyItem)
 {
     return((this.EditingTemplate != null)
 ? this.EditingTemplate.LoadContent() as FrameworkElement
 : null);
 }
Ejemplo n.º 19
0
 internal FrameworkElement GenerateEditingElementInternal(PropertyItemBase propertyItem)
 {
     return(this.GenerateEditingElement(propertyItem));
 }
Ejemplo n.º 20
0
 public abstract Binding CreateChildrenDefaultBinding(PropertyItemBase propertyItem);
Ejemplo n.º 21
0
 public abstract object ItemFromContainer(PropertyItemBase container);
Ejemplo n.º 22
0
 protected FrameworkElement CreateCustomEditor(EditorDefinitionBase customEditor, PropertyItemBase propertyItem)
 {
     return((customEditor != null)
 ? customEditor.GenerateEditingElementInternal(propertyItem)
 : null);
 }