Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

Commented Unassigned: PropertyGrid does not support type converter [20640]

$
0
0
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: fitidnc **

Hello, I just created a custom collection that implements ICustomTypeDescriptor. Very well described here
http://www.codeproject.com/Articles/4448/Customized-display-of-collection-data-in-a-Propert
It works perfectly fine except using TypeConverter to change the display name of the custom collection. How can I display some custom name instead of "type" name that propertygrid shows for the collection. I don't want that to be editable with a text box or anything. I just want it to display a custom name instead of "type" name.


Viewing all articles
Browse latest Browse all 4964

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>