I have a Button
Style:
<Style TargetType="{x:Type Button}" x:Key="myBtnStyle">
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0"
x:Name="myTextBlock" />
<Rectangle Grid.Row="1"
x:Name="myRectangle" />
</ close everything>
Is there any way to pass in values (Text
, and Fill
to myTextBlock and myRectangle respectively) when I assign the style to the button?
<Button Style="{StaticResource ResourceKey=myBtnStyle /*assign Text and Fill here?*/ }"
Click="myBtn_Click" />
If I can't assign it there, then where can I assign it?