How can a WPF app. modify its own XAML?

I am new to XAML and WPF, and am wondering if the GUI can have controls that allow the user to modify the way the dialog (or form) displays?  For example, by changing between a StackPanel and a DockPanel, it may look very different. How can I allow the user to change from one to the other, then render that change in the user's view?  XAML is interpreted, right?

So how can I give the user that power and havde it be real time, and not require them to have Visual Studio?


newbiewebSr. Software EngineerAsked:
Who is Participating?
P1ST0LPETEConnect With a Mentor Commented:
What you would want to do is have a main container in your XAML that acts the container for your "form area".
Something as simple as a grid:

   <Grid name="GridForm">

Then in your code behind you can dynamically create other panels/content and add them to your form container.
Like this:

TextBox textbox = new TextBox();
textbox.Name = "textbox1";

DockPanel dockpanel = new DockPanel();

GridForm.Children.Clear(); //removes previous content
GridForm.Children.Add(dockpanel); //adds new content
newbiewebSr. Software EngineerAuthor Commented:
I got my mind stuck on changing the XAML. But changing the page via the code behind is the logical way.


Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.