I am new to this website and new to programming and I have encountered a problem. I am using Visual Studio 2010, C# WPF Application.
I have this line of code in my program:
TextBlock.Inlines.Add
(new Run("text"){ Foreground = Brushes.Blue, FontWeight = FontWeights.ExtraBold });
This Line doesn't have any problems, but I have a Resource Dictionary already made with those setters and I'm not sure how I can use it programmatically for each line. I tried something like this but it didn't do anything:
TextBlock.Inlines.Add
(new Run("text") { Style = (Style)this.Resources["bluebold"] });
What I think the problem might be is that I'm not calling the Resource dictionary which is called "Styles.xaml" in the code and I am unsure on how to do that.