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 (eg from-to strings) without the need of a custom UITypeEditor
:
http://msdn.microsoft.com/en-us/library/ayybcxe5.aspx
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.