Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - Dynamic Form in WPF

Reply
 
Old 06-16-2009   #1 (permalink)
STA


 
 

Dynamic Form in WPF

Hi there - I need to build a WPF form dynamically based on a
collection of objects. This collection is of varying length and the
objects vary also - sometimes there may be several bits of text that
need their textboxes (and corresponding labels) created; sometimes
there may be a date that needs a datebox.

I've made progress using StackPanel.Children.Add(obj), and adding the
label item to the "label side" stackpanel and the object to the
element side, but that seems like a very code-heavy approach --
WinForms-ish, even (though admittedly I'm not much of a Win dev, and
I'm a WPF rookie).

So my question is this: it seems like everything I've seen from WPF
indicates that I should be able to databind on that collection and use
some sort of binding templates to, say, call up the textbox template
when I need a textbox, the datepicker when I have a date, radio for
boolean, etc. Ideally, those templates would also contain validation
templates for each control type.But I can't find examples of this or
very clear guidance. There are many different questions here, and too
many variables for a clear, succinct answer, but any help would be
very much appreciated. I've tried the heavy backend coding to just
make progress and get the elements on the page, and I've even
considered analyzing the collection and using XSLT to dynmically
create an entire XAML page (if it's possible to process that page
after a transformation). But again, it seems like there's something
simple and elegant and built-in that I must be missing.

Again, I'm a WPF rookie over from the web/SQL world.
Thanks very much,
Sean

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
VB.NET: dynamic css .NET General
dynamic loaded ascx delegate event not firing in parent form .NET General
Can't set up Dynamic Drive Vista installation & setup
Dynamic Backgrounds Live Messenger


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46