Solved

How can a WPF app. modify its own XAML?

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Install Problem 13 29
Hey Audio! 3 27
Batch file or script with password 22 38
VB.Net - MemoryMappedFiles - Confirm receipt 2 17
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…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

813 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

12 Experts available now in Live!

Get 1:1 Help Now