When using the propertygrid (in Visual Studio or the property grod
control), it allows for us to edit properties of multiple objects.
Now, let's say we have two textboxes TextBox1 and TextBox2 with
TextBox1.Visible = false and textBox2.Visible = true;
Now, let's say we are editing both these textboxes ( multiselect ), in
the propertygrid --a "blank" value is shown for the Visible property
(since the property values differ). Note that, the UITypeeditor (if
any) shows up correctly.
Obviously, the property grid is checking if the values differ and
showing a "blank" string.
I have a scenario, where I need to show a "blank" value for primitive
types in the property grid. The scenario is NOT a multi-select case
though.
I want to do something similar with the certain properties( of
primitive types bool, int, double etc) of my Custom Control. These
properties do NOT have a reasonable default value at design-time and I
would like to display the a "blank" value at design-time. But, i do not
want to loose the typeeditors (like the boolean drop-down list) that is
provided by the type.
Since the property grid is capable of such behaviour (showing "blank"
depending on a bool), is there support in the .NET framework for me to
implement this behaviour explicitly(via TypeConverters)?
For Example:
I have a property
public double MyProperty
{
get ; set;
}
and I have a bool DoesMyPropertyHaveADefault - to determine whether the
property grid should show a "blank" value. This bool can be maintained
internally.
Bgm
jokiz - 15 Feb 2006 10:09 GMT
try to explore the MergablePropertyAttribute