Tech
Forums
Jobs
Books
Events
Live
Interviews
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
1
Reply
How to change the dynamic resource in the Button Click
Ganeshkumar Lingappan
Mar 10 2016 2:24 AM
376
Reply
I am new to WPF and i need to learn the static resource and dynamic resource. i have tried to set the style for button using the Dynamic Resource and change the style using button Click but the style is not changed. please refer my code i used for change the button style using click
Codes :
<Window.Resources>
<Style x:Key="Style1" TargetType="Button">
<Setter Property="Background" Value="Red" />
</Style>
</Window.Resources>
<Button x:Name="Content" Content="Content" Height="30" Width="200" Style="{DynamicResource ResourceKey=Style1}" Click="Content_Click" />
Click :
private void Content_Click(object sender, RoutedEventArgs e)
{
this.Resources.Add("Style1", new SolidColorBrush(Colors.Blue));
}
Could you please any one guide me how to achieve my requirement.
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
Binding and Converter via IValueConverter
how to bind combobox in datagrid with database