How to assign a dynamic resource style in code?
c#, code-behind, styles, wpf, xaml
Solution
You can try:
tb.Style = (Style)FindResource("FormLabelStyle");
Enjoy!
Problem
I want to produce in code the equivalent of this in XAML: ``` <TextBlock Text="Title:" Width="{Binding FormLabelColumnWidth}" Style="{DynamicResource FormLabelStyle}"/> ``` I can do the text and the width, but how do I assign the dynamic resource to the style: ``` TextBlock tb = new TextBlock(); tb.Text = "Title:"; tb.Width = FormLabelColumnWidth; tb.Style = ??? ```