Welcome to AddressOf.com Sign in | Join | Help

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 pathing 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.

Published Thursday, January 31, 2019 6:18 PM by CorySmith


No Comments

Anonymous comments are disabled