2

ここから、WpfToolkitIntegerUpDownコントロールの暗黙的なカスタム スタイルを作成できるようです。

<Style TargetType="xctk:IntegerUpDown"
       BasedOn="{StaticResource {x:Type xctk:IntegerUpDown}}">

ただし、WpfToolkit のカスタムの暗黙的なスタイルを作成できないようですWatermarkTextBox。私はこれを試しましたが、コンパイルされません:

<ResourceDictionary xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" ...>

<Style TargetType="xctk:WatermarkTextBox"
       BasedOn="{StaticResource {x:Type xctk:WatermarkTextBox}}">...</Style>

エラーが発生します:

テキスト「xctk:WatermarkTextBox」から「TargetType」を作成できませんでした

また試しました:

<Style TargetType="{x:Type Control}" BasedOn="{StaticResource BaseStyle}" x:Key="WatermarkBaseStyle">
    <Setter Property="FontSize" Value="24" />
</Style>
<Style TargetType="{x:Type xctk:WatermarkTextBox}" BasedOn="{StaticResource WatermarkBaseStyle}"/>

エラーが発生します:

「テキスト「xctk:WatermarkTextBox」から「タイプ」を作成できませんでした。

4

1 に答える 1

2

以下は私にとってはうまくいきます:

<Style TargetType="{x:Type xctk:WatermarkTextBox}" 
       BasedOn="{StaticResource {x:Type xctk:WatermarkTextBox}}">

プロパティとプロパティの両方x:Typeマークアップ拡張機能を使用してみてください。TargetTypeBasedOn

于 2015-07-15T06:36:02.213 に答える