Пример #1
0
        private void PropertyGrid_OnPreparePropertyItem(object sender, PropertyItemEventArgs e)
        {
            if (e.PropertyItem.IsExpandable &&
                e.PropertyItem is PropertyItem p && p.PropertyDescriptor.Attributes.Contains(new ExpandAttribute()))
            {
                e.PropertyItem.IsExpanded = true;
            }

            e.PropertyItem.DisplayName = e.PropertyItem.DisplayName.SplitCamelCase();
        }
        private void OnPreparePropertyItem(object sender, PropertyItemEventArgs e)
        {
            var propertyItem = e.PropertyItem as PropertyItem;
            // Parent of top-level properties is the PropertyGrid itself.
            bool isTopLevelProperty =
                (propertyItem.ParentElement is Xceed.Wpf.Toolkit.PropertyGrid.PropertyGrid);

            if (isTopLevelProperty && propertyItem.PropertyDescriptor.Name == "Friend")
            {
                propertyItem.DisplayName = "Friend (renamed)";
            }
        }
Пример #3
0
 private void OnPropertyGridPreparePropertyItem(object sender, PropertyItemEventArgs e)
 {
     // In a later version of the Xceed PropertyGrid we can specify if a property is initially
     // expanded when shown in the property grid by setting a property on the ExpandableObject
     // attribute.  This workaround lets us initially expand any expandable property whose name
     // is in the list of properties we wish to automatically expand.
     if (e.PropertyItem is PropertyItem propertyItem)
     {
         if (this.autoExpandedProperties.Contains(propertyItem.PropertyName) && propertyItem.IsExpandable && !propertyItem.IsExpanded)
         {
             propertyItem.IsExpanded = true;
         }
     }
 }
        private void LetsPreparePropertyItem(object sender, PropertyItemEventArgs e)
        {
            var prop = e.PropertyItem as PropertyItem;

            if (prop == null)
            {
                return;
            }

            prop.MinHeight = 22;
            if (!prop.PropertyType.IsValueType && prop.PropertyType != typeof(string))
            {
                prop.IsExpandable = true;
            }
        }
 void PropertyGrid_PreparePropertyItem(object sender, PropertyItemEventArgs e)
 {
     if (e.PropertyItem.ParentElement is PropertyItem)
     {
         PropertyItem aParentPropertyItem = e.PropertyItem.ParentElement as PropertyItem;
         if (aParentPropertyItem == null)
         {
             return;
         }
         PropertyItem aChildPropertyItem = e.PropertyItem as PropertyItem;
         if (aChildPropertyItem.PropertyName != "R" &&
             aChildPropertyItem.PropertyName != "G" &&
             aChildPropertyItem.PropertyName != "B")
         {
             e.PropertyItem.Visibility = Visibility.Collapsed;
             e.Handled = true;
         }
     }
 }
Пример #6
0
 private void PropertyGrid_PreparePropertyItem(object sender, PropertyItemEventArgs e)
 {
     var grid = (PropertyGrid)e.Source;
 }