How to read Windows.UI.XAML.Style properties in C#
- by Igor Kulman
I am writing a class that will convert a HTML document to a list of Paragrpahs that can be used with RichTextBlock in Windows 8 apps. I want to be able to give the class a list of Styles defined in XAML and the class will read useful properties from the style and apply them.
If I have a Windows.UI.XAML.Style style how do I read a property from it? I tried
var fontWeight = style.GetValue(TextElement.FontWeightProperty)
for a style defined in XAML with TargetProperty="TextBlock" but this fails with and exception