I have a class MinMax which among other things contains this:
public class MinMax
{
private float m_min = 0;
private float m_max = 1;
public override string ToString()
{
return m_min + " " + m_max;
}
}
I also have another class SomeClass with a property of this type:
public MinMax Something
{
get
{
return m_something;
}
set
{
m_something = value;
}
}
When I put an object of type SomeClass in a property grid, Something is correctly displayed but for natural reasons I’m not able to edit the value.
I know I can create a custom type editor and show a custom form to edit it, but I would like to edit the displayed string directly.
My first solution was to return a string from Something instead but I have other code that needs this property to be returned in it’s native format.
Is thera any other convenient solution that will let med edit the value directly as a string in the propertygrid?
Maybe you’re looking for a Custom
UITypeEditor:http://msdn.microsoft.com/en-us/library/ms171840.aspx
For completeness have a look also to
TypeConverter,that can be used to allow simple editing (e.g. from-to strings) without the need of a custom
UITypeEditor:http://msdn.microsoft.com/en-us/library/ayybcxe5.aspx