Solved

How can a WPF app. modify its own XAML?

Posted on 2011-02-12
2
420 Views
Last Modified: 2012-05-11
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?

Curious...

newbieweb
0
Comment
Question by:newbieweb
2 Comments
 
LVL 10

Accepted Solution

by:
P1ST0LPETE earned 500 total points
ID: 34881330
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();
dockpanel.Children.Add(textbox);

GridForm.Children.Clear(); //removes previous content
GridForm.Children.Add(dockpanel); //adds new content
0
 

Author Closing Comment

by:newbieweb
ID: 34881500
I got my mind stuck on changing the XAML. But changing the page via the code behind is the logical way.

Thanks!

newbieweb
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question