Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/entity-framework/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wpf 附加行为和样式_Wpf_Silverlight_Styles_Attachedbehaviors - Fatal编程技术网

Wpf 附加行为和样式

Wpf 附加行为和样式,wpf,silverlight,styles,attachedbehaviors,Wpf,Silverlight,Styles,Attachedbehaviors,我使用了一个附加的行为,允许双击事件连接到视图模型中的命令,如下所示: <ListBox Style="{StaticResource MasterListBoxStyle}" b:SelectionBehavior.DoubleClickCommand="{Binding EditCommand}" > 我需要一个演示文稿的多个列表框,所有这些都需要连接到EditCommand的双击 我可以将这种行为推广到我的MasterListBoxStyle中吗?怎么

我使用了一个附加的行为,允许双击事件连接到视图模型中的命令,如下所示:

<ListBox Style="{StaticResource MasterListBoxStyle}"
    b:SelectionBehavior.DoubleClickCommand="{Binding EditCommand}" 
     >

我需要一个演示文稿的多个列表框,所有这些都需要连接到EditCommand的双击

我可以将这种行为推广到我的MasterListBoxStyle中吗?怎么做

干杯,
贝里尔


您应该能够在WPF中添加这样一个简单的Setter:

<Setter Property="b:SelectionBehavior.DoubleClickCommand" Value="{Binding EditCommand}" />

假设
b
xmlns是在包含样式的XAML文件中定义的


但这在Silverlight中不起作用,因为setter中不支持绑定。这是微软正在解决的问题。

我本来打算尝试一下,然后我想“不,太简单了”:--)
<Setter Property="b:SelectionBehavior.DoubleClickCommand" Value="{Binding EditCommand}" />