2

私の場合、構成設定に基づいて、グリッド線は異なる色で表示されるはずです。

TargetType で単純なスタイルを定義しましたCellValuePresenterが、ターゲット タイプが でCellValuePresenter、独自のControlTemplate. また、ソリューション全体にControlTemplates を含む多くのスタイルがあり、それらすべてを私が作成したこの新しいスタイルに変更することはできません。CellValuePresenterBasedOn

sを含むスタイルがControlTemplate変更をそれぞれ変更せずにピックアップするためのオプションは何ですか。

4

2 に答える 2

2

BasedOnスタイルをその要素のデフォルト スタイルにして、暗黙的なスタイルのすべてのセッターも含めることができます。

例えば、

<Style TargetType="{x:Type CellValuePresenter}">
    <!-- Generic Style Setters -->
</Style>

<!-- This Style will include the setters from the implicit style above -->
<Style x:Key="CustomCellStyle"
       TargetType="{x:Type CellValuePresenter}"
       BasedOn="{StaticResource {x:Type CellValuePresenter}}">

    <Setter Property="ControlTemplate" ... />

</Style>
于 2013-04-26T19:31:17.660 に答える