propertygrid

C# Propertygrid combobox with enum values (Win Forms)

╄→尐↘猪︶ㄣ 提交于 2019-12-21 06:18:45
问题 public enum eVisualType { None = 0, Torch = 1, Rune01, Rune02, Rune03, FireRed01, LaserBlackWhiteLeft, LaserBlackWhiteRight, LaserBlueRedLeft, LaserBlueRedRight, Wheel01, Wheel01a, Wheel02, BlinkingStar, MovingPillar } public class EnumTypeConverter : TypeConverter { public override bool GetStandardValuesSupported(ITypeDescriptorContext context) { return true; // True means show a combobox } public override bool GetStandardValuesExclusive(ITypeDescriptorContext context) { return true; // True

Is it possible to hide an enum value from a PropertyGrid?

白昼怎懂夜的黑 提交于 2019-12-20 02:41:31
问题 I'm working with the PropertyGrid control and using the SelectedObject property to display data within the PropertyGrid . Some of the properties in my grid are enum types. What I'd like to be able to do is hide some of the selections within the enum from the user. Take the below example: I would like to hide the enum of "Error" from the user. Is there a way to do this? [TypeConverter(typeof(PropertySorter))] public class Settings { public enum FooType { Type1, Type2, Type3, Type4, Error };

Convert string array to enum on the fly

心已入冬 提交于 2019-12-19 16:12:50
问题 I am binding an enum to a property grid like this: public enum myEnum { Ethernet, Wireless, Bluetooth } public class MyClass { public MyClass() { MyProperty = MyEnum.Wireless; } [DefaultValue(MyEnum.Wireless)] public MyEnum MyProperty { get; set; } } public Form1() { InitializeComponent(); PropertyGrid pg = new PropertyGrid(); pg.SelectedObject = new MyClass(); pg.Dock = DockStyle.Fill; this.Controls.Add(pg); } My problem: I get data on the fly when the program is running. I read the network

PropertyGrid doesn't notice properties changed in code?

无人久伴 提交于 2019-12-19 05:22:28
问题 I have a Winform application which uses colour to highlight certain things. I would like to allow the users to change 'their' colours. As an exercise, I thought I would create an instance of a class, with properties for the colours, and assign it to a property grid (to get a nice editor) . This seems to work fine, but I then thought I would like to let the users reset the colours (after they had fiddled and set them to 20 shades of beige) . So, I added a "reset" button to my form, which set

WPF PropertyGrid - adding support for collections

痞子三分冷 提交于 2019-12-19 04:43:10
问题 I am working on wpf PropertyGrid (PG) control and I want the PG to support collection type( IList , ObservableCollection etc.) properties. I am bit confused on how to keep track of selected item(of that collection) and pass that to client. Any ideas? If the solution makes use of the Open Source WPF PropertyGrid (http://www.codeplex.com/wpg) I will implement the changes /additions back into the control. 回答1: No answers proves that there is no straight forward way of doing this. So I

Xceed WPF propertyGrid show item for expanded collection

南楼画角 提交于 2019-12-18 11:54:01
问题 How, do I display a ObservableCollection<> of custom objects in the Xceed WPF PropertyGrid in which each List Item can be expanded to display the custom objects properties. (ie: ----PropertyGrid----- CoreClass (+/-) ObservableCollection< CustomClass > (+/-) CustomClass.Object1 Property1: Value Property2: Value … PropertyN: Value (+/-) CustomClass.Object2 Property1: Value Property2: Value … PropertyN: Value If I use [ExpandableObject] on the ObservableCollection<> it only shows the Counts

Expand C# propertygrid on show

萝らか妹 提交于 2019-12-18 04:54:36
问题 i have a question about property grid. when the form is shown i would like a group to be expand rather then collapsed. i have search a lot for that on the web and could not find it yet. any thoughts. 回答1: If you want to expand all items in the grid it is fairly simple. The property grid has a method for doing that: propertyGrid.ExpandAllGridItems(); If it is a certain group you want to expand you can use this method: private static void ExpandGroup(PropertyGrid propertyGrid, string groupName)

Windows 10 Creators Update changes the style of PropertyGrid control

风流意气都作罢 提交于 2019-12-18 04:50:56
问题 I just upgraded some systems to Windows 10 Creators Update and I noticed that the windows forms PropertyGrid control changed its default visual style for headers and bar margins to dark gray, like so: And as mostly happens with unexpected visual changes, users are not happy. Is there a way to revert back to the old default or maybe override the default style? 回答1: There's a bug in PropertyGrid: The property PropertyGrid.LineColor has a DefaultValue attribute Set to SystemColors.InactiveBorder

How do I inject a custom UITypeEditor for all properties of a closed-source type?

允我心安 提交于 2019-12-17 16:39:06
问题 I want to avoid placing an EditorAttribute on every instance of a certain type that I've written a custom UITypeEditor for. I can't place an EditorAttribute on the type because I can't modify the source. I have a reference to the only PropertyGrid instance that will be used. Can I tell a PropertyGrid instance (or all instances) to use a custom UITypeEditor whenever it encounters a specific type? Here is an MSDN article that provides are starting point on how to do this in .NET 2.0 or greater.

How to modify PropertyGrid at runtime (add/remove property and dynamic types/enums)

谁说我不能喝 提交于 2019-12-17 15:36:21
问题 How do you modify a propertygrid at runtime in every way? I want to be able to add and remove properties and add "dynamic types", what I mean with that is a type that result in a runtime generated dropdown in the propertygrid using a TypeConverter. I have actually been able to do both those things (add/remove properties and add dynamic type) but only separately not at the same time. To implement the support to add and remove properties at runtime I used this codeproject article and modified