When I have a property with a custom type which has a type converter attribute, the property grid only shows the type name of the property, not the value provided by the type converter. Binding the same property to a TextBox lets me edit the proper converted type.
```
class Sample
{
public StringDictionary StringMapping
{
get
{
return _stringMapping;
}
set
{
if (_stringMapping == value)
return;
_stringMapping = value;
OnPropertyChanged();
}
}
}
[TypeConverter(typeof(StringDictionaryConverter))]
[Serializable]
public class StringDictionary : Dictionary<string, string>
{
public StringDictionary()
{
}
protected StringDictionary(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}
public class StringDictionaryConverter : SimpleDictionaryConverter<string, string, StringDictionary>
{
// convert dict to "key1=value1 key2=value2 ..." and vice versa
}
```
A text box will let me edit the values, while the property grid only shows "somenamespace.StringDictionary"
Comments: ** Comment from web user: tomenglert **
```
class Sample
{
public StringDictionary StringMapping
{
get
{
return _stringMapping;
}
set
{
if (_stringMapping == value)
return;
_stringMapping = value;
OnPropertyChanged();
}
}
}
[TypeConverter(typeof(StringDictionaryConverter))]
[Serializable]
public class StringDictionary : Dictionary<string, string>
{
public StringDictionary()
{
}
protected StringDictionary(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}
public class StringDictionaryConverter : SimpleDictionaryConverter<string, string, StringDictionary>
{
// convert dict to "key1=value1 key2=value2 ..." and vice versa
}
```
A text box will let me edit the values, while the property grid only shows "somenamespace.StringDictionary"
Comments: ** Comment from web user: tomenglert **
To BoucherS: An how would the property grid write back the edited value to the ToString method?????