By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,903 Members | 1,977 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,903 IT Pros & Developers. It's quick & easy.

dynamic winforms UI

P: n/a
Can anyone suggest a best practice approach to building a dynamic
winforms UI.

Just as an example somehting like a billing application where you
enter a customer billing data and the billing options, the UI and the
winform controls you have visible are dynamic and can change as
information is entered, so that there is a dependency between between
the data you enter and how other controls react, and/or are even
selectable

In addtion the UI should be dynamic in that it can vary when it is
first shown. So the problems i imagine with this is the winforms is
built by a designer, and that makes its layout fixed.
So should i look at multiple forms, and show the relevant one only or
is a better approach to build the UI in code and not use the designer
at all.

Does anyone have any info on a best practice approach for this sort of
task or any advice or any tutorials etc.
thanks for any info

Peted
Jun 27 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Peted" wrote in message news:5l********************************@4ax.com...
Can anyone suggest a best practice approach to building a dynamic
winforms UI.

Just as an example somehting like a billing application where you
enter a customer billing data and the billing options, the UI and the
winform controls you have visible are dynamic and can change as
information is entered, so that there is a dependency between between
the data you enter and how other controls react, and/or are even
selectable

In addtion the UI should be dynamic in that it can vary when it is
first shown. So the problems i imagine with this is the winforms is
built by a designer, and that makes its layout fixed.
If you look at the designer-generated code, you will find out that the
designer is actually writing code which generates the layout dynamically
when it is executed from the form constructor.
There is nothing to prevent you from writing code like that and
executing it yourself, thereby generating a dynamic layout. For instance, to
add a new textbox to the form you do this:
TextBox t = new TextBox();
t.Top = 200; //Change properties as needed
this.Controls.Add(t);

Basically, whatever you add to the Controls collection of the Form will
appear on screen. Of course, you can also remove elements from the
collection.
Jun 27 '08 #2

P: n/a
On Jun 23, 10:23*pm, Peted wrote:
Can anyone suggest a best practice approach to building a dynamic
winforms UI.

Just as an example somehting like a billing application where you
enter a customer billing data and the billing options, the UI and the
winform controls you have visible are dynamic and can change as
information is entered, so that there is a dependency between between
the data you enter and how other controls react, and/or are even
selectable

In addtion the UI should be dynamic in that it can vary when it is
first shown. So the problems i imagine with this is the winforms is
built by a designer, and that makes its layout fixed.
So should i look at multiple forms, and show the relevant one only or
is a better approach to build the UI in code and not use the designer
at all.

Does anyone have any info on a best practice approach for this sort of
task or any advice or any tutorials etc.

thanks for any info

Peted
You can do the UI as dynamic as you want. You can read the description
from a XML file and create the controls at runtime.
you would need a good framework though to handle the events of such a
form.
We use something similar where all the interface is defined in a XML
file.
Take a look at the Model View Presenter pattern as a way to handle the
user interaction
Jun 27 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.