propertygrid

How does the PropertyGrid control display two levels of nested dynamic JSON objects?

安稳与你 提交于 2021-02-11 15:02:33
问题 I have a requirement that several of my colleagues' configuration files should be displayed uniformly with the PropertyGrid control, which I have implemented with reference to the following post:https://www.codeproject.com/Articles/193462/Using-PropertyGrid-to-Display-and-Edit-Dynamic-Obj. My way is: define a ConfigObject object first, then deserialized json configuration file into ConfigObject object using JsonConvert.Convert(Newtonsoft.Json), and then assigned to the PropertyGrid

Change items of a dropdown property editor based on another property?

[亡魂溺海] 提交于 2021-01-27 22:10:15
问题 I am trying to implement a drop-down property in a custom component, and I used This SO Answer and this answer as a guide. So far I managed to get it working, with predefined items in the drop-down list. But I still need to figure out how to alter the items in the drop-down list ? This is the code I have so far (build from the link mentioned above) [TypeConverter(typeof(TableNameConverter))] public TableName gttTableName { get; set; } ... public class TableName { public string Name { get; set

PropertyGrid - Load dropdown values dynamically

眉间皱痕 提交于 2020-12-13 03:18:16
问题 I've tried all sorts - lots of messing around with TypeConverters etc. So I won't cover all that here. So to reduce the question to its basics. Considering the below: Imports LiteDB Imports System.ComponentModel Public Class mSystem <CategoryAttribute("General"), ReadOnlyAttribute(True)> Public Property ID As Integer Public Property ShortName As String = "" <BsonRef("mSystemTypes")> Public Property SystemType As mSystemType End Class Public Class mSystemType <CategoryAttribute("General"),

PropertyGrid - Load dropdown values dynamically

杀马特。学长 韩版系。学妹 提交于 2020-12-13 03:18:08
问题 I've tried all sorts - lots of messing around with TypeConverters etc. So I won't cover all that here. So to reduce the question to its basics. Considering the below: Imports LiteDB Imports System.ComponentModel Public Class mSystem <CategoryAttribute("General"), ReadOnlyAttribute(True)> Public Property ID As Integer Public Property ShortName As String = "" <BsonRef("mSystemTypes")> Public Property SystemType As mSystemType End Class Public Class mSystemType <CategoryAttribute("General"),

Changing Browsable Attribute at Runtime (C#)

大城市里の小女人 提交于 2020-08-24 07:52:05
问题 I'm trying to change the Browsable attribute of a variable in one of my classes at runtime. The class containing the attribute looks like this: public class DisplayWallType : WallType { [TypeConverter(typeof(SheathingOptionsConverter))] [Browsable(false)] public override Sheathing SheathingType { get; set; } public DisplayWallType(string passedName, string passedType, bool passedMirrorable, Distance passedHeight, string passedStudPattern, Distance passedStudSpacing, VaporBarrier passedBarrier

C# WPF property grid file browser

醉酒当歌 提交于 2020-08-08 05:18:30
问题 I have a property grid connected with public class properties. As I have seen in many solutions by adding an EditorAttribute I should be able to use a file browser: public class properties { public properties() { PartProgramConfigurationFilename = "Unknow"; } [Category("File")] // BELOW CUSTOM EDITOR [EditorAttribute(typeof(System.Windows.Forms.FileDialog), typeof(System.Drawing.Design.UITypeEditor))] [Description("Description"), DisplayName("PP configuration filename")] public string

Category Ordering In Xceed PropertyGrid

断了今生、忘了曾经 提交于 2020-04-30 05:06:53
问题 I am using PropertyGrid of Xceed to display characteristics of some elements. There are different categories for element like: General, Advanced, Others, Special. Here, I found that the Xceed's propertygrid sorts the category as well as property in alphabetical order. I was able to sort the properties inside the categories by using [PropertyOrder(n)] . I also wanted to sort the categories so, I tried using CategoryOrder like [CategoryOrder("General", 0)] but it shows the following error:

Can you/How to specify Editor at runtime for PropertyGrid (for PCL)?

不羁的心 提交于 2020-02-01 09:39:28
问题 I wrote a PCL with custom objects in there, and then I create a GUI that handles the objects from the PCL... and I try to use PropertyGrid to edit the properties... I've already read that in order for the grid to know what to do with the object, I need to specify the EditorAttribute as well as providing a TypeConverter... but I don't think I could add those 2 in the PCL... Is there a way to handle this at the GUI level, like telling the PropertyGrid to use a specific type of Editor

How to set DefaultValueAttribute of the PropertyGrid dynamically or at runtime?

故事扮演 提交于 2020-01-23 09:45:08
问题 I am defining a custom class to be used with the PropertyGrid control. Say, one of the properties is defined as such: [CategoryAttribute("Section Name"), DefaultValueAttribute("Default value"), DescriptionAttribute("My property description")] public string MyPropertyName { get { return _MyPropertyName; } set { _MyPropertyName = value; } } private string _MyPropertyName; As you see DefaultValueAttribute defines a default value for the property. Such default value is used in two cases: If this