TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ganeshkumar Lingappan
NA
112
31.1k
How to change the dynamic resource in the Button Click
Mar 10 2016 2:24 AM
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.
Reply
Answers (
2
)
Binding and Converter via IValueConverter
how to bind combobox in datagrid with database