WPF: can a UserControl be saved as xaml or baml at runn-time?

H

Haiping

I have a UserControl whith Canvas as its content. It lets uses add controls,
include Labels, TextBox, Charts, into this UserControl. After user is done
with it can it be saved as XAML or BAML file? So later user can load his
file, and edit it. If the UserControl cannot be saved as XAML or BAML what
is the other way to save it ?

thanks for any inputs,
 
P

Pavel Minaev

I have a UserControl whith Canvas as its content. It lets uses add controls,
include Labels, TextBox, Charts, into this UserControl. After user is done
with it can it be saved as XAML or BAML file?

Have a look at XamlWriter.Save. This comes with some limitations,
though - for example, it will resolve and expand StaticResource
references in the output, and it will ignore event handlers.
 
P

Pavel Minaev

I have a UserControl whith Canvas as its content. It lets uses add controls,
include Labels, TextBox, Charts, into this UserControl. After user is done
with it can it be saved as XAML or BAML file?

Have a look at XamlWriter.Save. This comes with some limitations,
though - for example, it will resolve and expand StaticResource
references in the output, and it will ignore event handlers.
 
H

Haiping

Thank you Pavel,
I found XamlWriter.Save too. I may not need event handler in my UserControl.
I am going to try it.
 
H

Haiping

Thank you Pavel,
I found XamlWriter.Save too. I may not need event handler in my UserControl.
I am going to try it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top