Search code examples
c#windows-8microsoft-metro

Windows 8 metro apps assign button style programmatically C#


I am trying to set style to button programmatically in C#, i tried it but not done it, i set style to button in XAML so its working fine. But in C# programmatically m not sure how to do it..

In XAML i did like this

Style="{StaticResource DefaultMusicButtonStyle}"

Solution

  • testButton.Style = Resources["DefaultMusicButtonStyle"] as Style;