Click here to Skip to main content
15,867,756 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I am new in WPF. I am using MVVM pattern.
Now i want to change the button back group color on button click.
Can any one please tell me how can i do it?

CSS
private Brush _brushobj;
        public Brush BrushObj
        {
            get
            {
                return _brushobj;
            }
            set
            {

                _brushobj = value;
                OnPropertyChanged("BrushObj");
            }
        }

C#



i have set the property like this. Now and bind this property with button like

Background="{Binding brushobj}"
C#



what other things are required?
i have to call it from button click function?
how can i call it?
Posted
Comments
Kenneth Haugland 21-Mar-14 3:34am    
If you use triggers you could do this in XAML only
viprat 21-Mar-14 4:17am    
i want to do it using MVVM. I mean i want to set background using viewmodel.

 
Share this answer
 
Comments
viprat 21-Mar-14 4:19am    
i want to do it using MVVM. I mean i want to set background using viewmodel.
Use behaviors to do any actions on event, when using MVVM.
Go through about Behaviors

http://wpftutorial.net/Behaviors.html[^]

Regards,
Karuppasamy
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900