Solved

How can a WPF app. modify its own XAML?

Posted on 2011-02-12
2
417 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

912 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now