【发布时间】:2011-06-26 12:47:17
【问题描述】:
我有扩展DataGrid 的自定义控件。它被称为ExtendedDataGrid。我想为ExtendedDataGrid 提供与DataGrids 样式相同的样式,只是它更改了模板。我尝试过这样的事情:
<Style TargetType="{x:Type MyControls:ExtendedDataGrid}" BasedOn="{StaticResource {x:Type DataGrid}}">
<Setter Property="Template">
...
</Setter>
</Style>
但它说找不到资源。
所以我试试:
<Style TargetType="{x:Type MyControls:ExtendedDataGrid}" BasedOn="{StaticResource {ComponentResourceKey ResourceId=DataGridStyle, TypeInTargetAssembly={x:Type DataGrid}}}">
<Setter Property="Template">
...
</Setter>
</Style>
但它也不起作用......那我该怎么办?
【问题讨论】: