views:

20

answers:

1

I have a user control which used to display data using a number of text blocks on a canvas. My intention is to be able to take all of the underlying properties from each text block (IE the top and left corners, height, width...) so I can draw them to a bitmap for printing. What would be the best approach for this? I was thinking of trying serialize the user control but I am not sure if that is the best approach. Also, I was wondering about trying to use the visual and logical trees to get the appropriate data.

+1  A: 

May be you will find useful XamlWriter http://msdn.microsoft.com/en-us/library/system.windows.markup.xamlwriter.aspx . It allows to serialize WPF control (and any other class) to XAML.

STO