How to read Windows.UI.XAML.Style properties in C#

Posted by Igor Kulman on Stack Overflow See other posts from Stack Overflow or by Igor Kulman
Published on 2012-10-26T14:29:09Z Indexed on 2012/10/26 17:01 UTC
Read the original article Hit count: 259

Filed under:
|
|
|

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

© Stack Overflow or respective owner

Related posts about c#

Related posts about xaml