PreparePropertyItem
PropertyGrid
Extended WPF Toolkit⢠by Xceed
以MVVM友好的方式:
<UserControl x:Class=(...)
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:mvvm="http://prismlibrary.com/"
(...)
<xctk:PropertyGrid x:Name="PropertyGrid" SelectedObject="{Binding}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="PreparePropertyItem">
<mvvm:InvokeCommandAction Command="{Binding PreparePropertyCommand}"/> //PRISM's InvokeCommandAction doesn't work
<i:InvokeCommandAction Command="{Binding PreparePropertyCommand}"/> //BLEND's InvokeCommandAction doesn't work either
</i:EventTrigger>
</i:Interaction.Triggers>
</xctk:PropertyGrid>
当加载或显示propertygrid时,不会调用我的自定义PreparePropertyCommand,只有当我单击以展开
[ExpandableObject]
<xctk:PropertyGrid x:Name="PropertyGrid" SelectedObject="{Binding}" PreparePropertyItem="PropertyGrid_PreparePropertyItem">
当然,这打破了MVVM模型
PropertyGrid_PreparePropertyItem
在视图的代码后面继续。
有什么见解吗?谢谢