C # styles without using xaml

I am trying to create an application that has specially created buttons. For this, I use Expression Web 4 and C # to run my application.

The fact is that I make buttons in my program dynamically, which is why I can’t "hard code" the buttons in the XAML file. I have a style that I want as XAML. I was wondering how I can add a style to a button using a C # file.

Or, if this is not possible, perhaps there is a way that I can restructure the program to create dynamically created buttons.

+3
source share
1 answer

Does the following code work?

myDynamicallyGeneratedButton.Style = (Style)Application.Current.Resources["ButtonStyle"]);

ButtonStyle is the style key in the application-level style resource

+3
source

Source: https://habr.com/ru/post/1791439/


All Articles