Click here to Skip to main content
15,919,434 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi. I am a beginner and my understanding of application design is very basic. I have just started to learn WPF and I am quite new to windows/graphics programming.

I am trying to create a wpf project that should contain at least three windows. The first window should get the input for "number of cars" using a text box. when the user clicks the 'submit' button, another window should appear with a bunch of textboxes to collect input for car details like name, model, top speed, year, etc.

Suppose if the user has given the input as '2' the second window should collect the details of car1 first and after user clicks 'submit cardetails' button, the same should collect the details of car2. Once the user fills up the details of all the cars and clicks submit, a third window should appear which will perform the application logic like car-comparison, best of choice, etc and display it to user.

I can create text boxes and other controls in seperate windows and i think i can use "newwindow.show();" method to open a new window during run time ? But, the major challenge for me is that the 'window2' should work according to the choice given by the user in 'window1'.

Could you please explain me how to create one such application ? I have so many ideas in my head to create many different computer applications, but I already have a job and I learn computer programming only as a hobby and can't financially afford to take formal courses on it. So, please help me to improve my skills in programming ;)

I would greatly appreciate it if you could please provide syntax, examples or graphical illustrations to explain your concepts so that a bog standard amateur like me can easily understand.

Cheers..
Posted

What you want is a wizard form. The Extended WPF Toolkit [^] provides just such an item.
 
Share this answer
 
Comments
steersteer 23-Aug-11 12:00pm    
Thanks for the reply. checked on that link. seems the wizard form has not been launched yet.!.lol.my bad..!
You should consider writing a class that stores some kind of arbitrary detail for a car:

C#
class CarDetail
{
   public string DetailName { get; set; }
   public string DetailValue { get; set; }
}


Then create a CarDetail object for each detail you want to collect. If you store this collection in a ViewModel, you can then bind an items control to it - and have the items control show a textbox :)

HTML
<itemscontrol itemssource="{Binding Details}">
 <itemscontrol.itemtemplate>
  <datatemplate>
   <stackpanel orientation="Horizontal">
    <textblock text="{Binding DetailName}" />
    <textbox text="{Binding DetailValue}" />
   </stackpanel>
  </datatemplate>
 </itemscontrol.itemtemplate>
</itemscontrol>


So what you are doing here is saying that we have a set of some arbitrary details - and how do we present each one? As a label the name of the detail, alongside a textbox to get the detail.

You can then later extend it so that if you want to collect other types of details you can use other datatemplates - one for a combo box, one for a checkbox etc.

To do this in this way you'll need to make sure that that classes implement INotifyPropertyChanged, read up on this at:

http://www.codeproject.com/KB/WPF/wpfstepbystep1.aspx[^]

which explains how to do that, or use a MVVM library such as Cinch V2: Version 2 of my Cinch MVVM framework: Part 1 of n[^] or even my own very simple one Introducing Apex[^]

Good luck!
 
Share this answer
 
Comments
steersteer 23-Aug-11 12:02pm    
cool. will try. Thanks..:)
Hello steersteer,

Thanks for your humble introduction. Don't worry, there's lots of help here to get you started. Show initiative, try things out, read blogs, download and try the samples and you'll get far.

If you ask questions with short code samples that illustrate your problems and show that you've tried to figure things out, you have a whole host of experts here that will help you work through things.

I've given you some reading on your other question that is quite similar, so I'll give you one more piece of advice: make sure you're not reposting questions. If you have something to clarify, go back to your original question and use the "Improve Question" feature.

As far as design goes, here's what I would expect to see in the UI as a user if the application was for creating a list of cars:
1) A side bar with a list of existing cars, in a summary view
2) A main area where I can add new cars
3) A way to open a second window/page to see a particular car in more detail (possibly edit)

Hope this helps you along the way.

Cheers.
 
Share this answer
 
Thanks for the reply, and sorry about my re-post. Just found the "improve question" feature. It's quite cool..!..

I thought of this car application because it was one of my childhood hobbies. Reading car magazines and collecting car details, and then writing it on a notebook and comparing them. Then probably play a game of custom car trump cards. lol..

yeah. Your design sounds awesome. But the problem i have is with the programming language and syntax.

for example,

If i store the number of cars textbox value as a variable 'n'

Then,

I was thinking of writing a code somewhat like this,

for(int i=0;i<n;i++)>
{
call a function that has cardetails textboxes

}

I don't know how to code down my idea. :(
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900