Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / February 2007

Tip: Looking for answers? Try searching our database.

WPF/Avalon: Adding Controls During Runtime

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
hufaunder@yahoo.com - 12 Feb 2007 18:24 GMT
I have to present inputs (textbox, combobox, etc) that are not known
during design time. In the past this was pretty simple to do. You just
add a new control to the Controls property of a form. How can I
achieve the same thing with WPF?

Thanks
Willy Denoyette [MVP] - 12 Feb 2007 19:54 GMT
>I have to present inputs (textbox, combobox, etc) that are not known
> during design time. In the past this was pretty simple to do. You just
> add a new control to the Controls property of a form. How can I
> achieve the same thing with WPF?
>
> Thanks

Please post XAML, WPF, WCF and WF questions to the msdn forums:

http://forums.microsoft.com/MSDN/default.aspx?ForumGroupID=153&SiteID=1

Willy.
RobinS - 13 Feb 2007 01:24 GMT
You can post these questions to
microsoft.public.windows.developer.winfx.avalon as well as the MSDN forums
already mentioned since it seems to annoy the C# group to post them there.

As you know (hopefully), the Window has a Content property that can only be
set to one thing. You don't state if your window is blank or already has a
panel or something in it.

If you have a panel, you can just add children to it.

 Button btn = New Button();
 btn.Content = "Yo Dude"
 myStackPanel.Children.Add(btn);

If you have an empty window, you can just set its content:

 Button btn = New Button();
 Content = btn;

Hope this helps.
Robin S.
-------------------------------------------
>I have to present inputs (textbox, combobox, etc) that are not known
> during design time. In the past this was pretty simple to do. You just
> add a new control to the Controls property of a form. How can I
> achieve the same thing with WPF?
>
> Thanks

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.