I desined a button in Blend, which gave me this xaml in after the namespace headers.
<UserControl.Resources>
<Style x:Key="ButtonStyle1" TargetType="Button">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<Rectangle Fill="#BF4FFFF" RadiusY="10" RadiusX="10" Stroke="Black"/>
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
At the runtime, I am generating a button to which I want to aply this style. How can this be done.
I noticed the buttons have button.Style property but I am not able to assing the style to it. Any suggestions?
You can access your resource dictionary in your code like: