0

我有一个绑定到集合的 SL3 DataGrid。数据网格的一列是 HyperlinkBut​​ton 列,我想将该列的单击事件绑定到 VM 中存在的 ICommand。

伪代码:

DataGrid ItemsSource="{Binding someCollection}" DataGridHyperLinkColumn Commands.Command="{Binding myClickCommand}"

现在在这种情况下,Commands.Command 试图在 someCollection 中找到 myClickCommand,而不是从 VM myClickCommand 属性中获取它。

我也尝试过修复 Commands.Command="{Binding Path=DataContext.myClickCommand, ElementName=nameOfUserControl}" 但也失败了。

出路是什么……?我不想使用 BindingHelper,因为 SL3 已经支持 ElementBinding ...

4

1 回答 1

0

瞧...... Dan Wahlin已经提供了一个解决方案:http: //weblogs.asp.net/dwahlin/archive/2009/08/20/creating-a-silverlight-datacontext-proxy-to-simplify-数据绑定嵌套控件.aspx

于 2009-11-03T14:43:53.017 回答