【发布时间】:2018-09-22 18:33:25
【问题描述】:
我重新设置了 DataGrid 的样式,但它变得相当复杂,因此我将样式(DataGrid、DataGridCell、DataGridRow、...)移动到了 ResourceDictionary。我给了他们一个 x:Key 并引用了它们,例如作为 DataGrid.RowStyle="{StaticResource SuperRowStyle}"。现在我也想在 Row 上使用 EventSetter,但显然我不能在 ResourceDictionary 中设置它,但我也不能在 Window 中设置它,因为它被 RowStyle 属性覆盖。我怎样才能做到这一点? BR, 丹尼尔
【问题讨论】:
-
在窗口中创建一个新样式,基于资源字典中定义的样式。使用这种风格的 EventSetter。