ウィンドウ リソースとしてを作成したいのですがStyle
、そのスタイルは、割り当てられたコントロールのプロパティにバインドする必要があります。以下はその簡単な例です。
ボタンのスタイルを作成し、Background
その割り当てられたボタン コントロール タグ プロパティを使用して色を適用します。
<Window.Resources>
<Style x:Key="TestingStyle" TargetType="Button">
<Setter Property="Background" Value="{Binding Tag}" />
</Style>
</Window.Resources>
に を追加するButton
と、このスタイルはその色を の背景に適用する必要がありColor
ます。これは可能ですか?Tag
Button
編集
以下は実際の XMAL コードです。
<Style x:Key="SeriesStyle" TargetType="Chart:ChartSeries">
<Setter Property="StrokeThickness" Value="2"/>
<Setter Property="PointMarkerTemplate">
<Setter.Value>
<ControlTemplate>
<Ellipse Width="7" Height="7" Fill="Lavender" Stroke="{Binding RelativeSource={RelativeSource Self}, Path=SeriesColor}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>