ExpandableObjectConverter still not working in the latest PropertyGrid

Grids for WPF Forum

Posted 7 years ago by Gordon Zhang
Version: 11.2.0552
Avatar

Hi there,

I search the forum and find the thread: http://www.actiprosoftware.com/community/thread/3250/expandableobjectconverter-typeconverter 3 years ago. I have similar situation and it seemed the propertygrid still does not work with TypeConverterAttributes.(I have propertyGrid Version 11.2

The class object "A" inside another class a "B", I use [TypeConverter(typeof(MyClassConverter)] to the property "A" in class B. But I still cannot see A property's name on the property grid. While the same thing works for WinForms' ProperyGrid. Can anyone give me any hint or small examples to make it works for the PropertyGrid? I can send you the sample project if you need.

Thanks

Gordon

Comments (3)

Answer - Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Gordon,

Please see our Custom TypeConverters QuickStart in our Sample Browser for a complete example. You would need to change the default property editor in order to leverage TypeConverters defined on properties. From that QuickStart:

 

<propgrid:PropertyGrid x:Name="propGrid" Grid.Column="0" MinHeight="300" Width="300"
		SelectedObject="{StaticResource TestObject}" SummaryCanAutoSize="True" SummaryHeight="Auto">
	<!-- When modifying properties directly using their native type WPF binding will only use the
	     TypeConverter defined for the given type. In order to leverage TypeConverters defined on
	     individual properties (and not the types themselves), we need to modify the property using
	     "string" values.
	
	     Below we change the default editor to work with the "string" values, instead of working with
	     the native types directly.
	-->
	<propgrid:PropertyGrid.PropertyEditors>
		<propgrid:PropertyEditor ValueTemplateKey="{x:Static propgrid:BuiltinEditors.DynamicStringValueTemplateKey}" />
	</propgrid:PropertyGrid.PropertyEditors>
</propgrid:PropertyGrid>


Actipro Software Support

Posted 7 years ago by Gordon Zhang
Avatar

Does property grid take RefreshPropertiesAttribute's (RefreshProperties.All) seriously?

I change QuickStart\CollectionDisplayMode\ChildObject::ToString() function to:

public overridestringToString() { return string.Format("Child Object Name: {0}", this.Name);}

When we change the name of Child to Child1, it won't show changes, untill we change the Display Mode from default to expandable. Does this mean the PropertyGrid does not take into account the RefreshProertiesAttribute seriously? The WinForms' one works perfectly.

Answer - Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Gordon,

Sorry, but RefreshPropertiesAttribute is not currently supported. You can see the complete list of support ComponentModel attributes that are supported in our help file.

Our PropertyGrid leverages WPF binding statements, where property changes are immediately reflected in UI. But this does require that your underlying objects implement INotifyPropertyChanged, use dependency properties, or include a XYZChanged event for each non-dependency property (where XYZ is the property name). With this in place, changes will be automatically sync'ed when the property change notification is received


Actipro Software Support

The latest build of this product (v2018.1 build 0675) was released 12 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.