
I have a class with a property of type ICommand (actually DelegateCommand). I want it to render as a Button in the PropertyGrid.
When it gets rendered by Actipro, it displays the full type name as expected. For other properties, I have successfully used the EditorAttribute to specify a custom Property Editor. Using the same mechanism, the PropertyGrid instead seems to ignore my EditorAttribute, and instead appears to call CommandConverter for some reason.
What am I missing?
Here is my code in C#
public class DelegateCommandPropertyEditor : PropertyEditor
{
public DelegateCommandPropertyEditor()
{
ValueTemplateKey = "DelegateCommandPropertyEditorValueTemplate";
}
}
[System.ComponentModel.Editor(typeof(DelegateCommandPropertyEditor), typeof(PropertyEditor))]
public class DelegateCommand : ICommand
{
...
}
Here is my ValueTemplate in the XAML (which is definitely being loaded)
<DataTemplate
x:Uid="DelegateCommandPropertyEditorValueTemplate"
x:Key="DelegateCommandPropertyEditorValueTemplate">
<Button
x:Uid="DelegateCommandPropertyEditorValueTemplateButton"
Margin="5,3,0,3"
VerticalAlignment="Center"
DataContext="{Binding Value}"
Command="{Binding}"
Content="{Binding DisplayName}" />
</DataTemplate>
[Modified 4 years ago]