PropertyGrid DefaultValue for non-Const values?
In the PropertyGrid
, you can specify in the target Control (or Class) an attribute that represents what the default value of the property should be. This doesn’t actually set the value, it is there for “informational” purposes. The PropertyGrid
, however, uses this information and displays values as “regular” text if it matches the default; bold if it does not. This works great for most properties… however, not so much for properties that can’t be represented as a constant such as default path based on the user account’s documents folder.
However, there is an answer to this problem… it requires that you create a method using a very specific pattern that the PropertyGrid
can leverage. For the details, see here.
This post is licensed under
CC BY 4.0
by the author.