| Home | Facebook | Freeware |

Saturday, May 29, 2010

How to Set WPF Button programatically with C#

bookmark again for today: Setting a style (once) in C#

You can do this change style programatically with c#:

button.Style = Application.Current.Resources["TopMenuItemButton"] as Style; // If your style is defined in App.xaml Application.Resources section

button.Style = this.Resources[StyleKey] as Style; // if your style is defined in Page.XAML UserControl.Resources section

button.Style = button.Resources[StyleKey] as Style; // if your style is defined in the XAML as control.Resouces section

Software Engineer
Aprimo, Inc