J
jehugaleahsa
Hello:
I have been trying to learn the basics about WPF. I am comfortable
with binding to other control properties and binding to XML, but I
have been having a lot of trouble binding to data objects (which is
really all I care about). I need some pointers. I thought if someone
could show me an example it would help me.
The example I would like to see:
I would like to have a form that has a collection of Person. Person
would be a class with the properties of Name and Age. There can be
multiple people in the collection. How I populate the collection is
irrelevant at this point (I'll probably just hard-code it).
I would like the form to provide a text box and a button for entering
in, say an Age. The button click event would populate the collection
with people under the given age.
I would to display all the people in a grid. I would also like there
to be two text boxes below that held the name and age of the currently
selected person. When you select a different person from the grid,
that person's information would show up below in the text boxes. When
you change a value in the text boxes below, it would update the grid's
data.
That's the simple example I want. In Windows Forms it was easy to do
this. You simply created a BindingSource and set its DataSource
property to a BindingList<Person>. You populated the BindingList in
order for the Form to show the people. You had Person implement
INotifyPropertyChanged. I am assuming it is just as easy in WPF. I
simply haven't found an example that really lays it out. Maybe I have
been looking in the wrong place.
I have been watching MS' webcasts and they have been illuminating. I
have been visiting tons of web sites. I have been finding good
tutorials and examples, but none that work with data objects in the
way I am looking for.
I made a lot of Windows Forms before I truly understood what I was
doing. I wasted a lot of time making forms that, while functional,
were not as versatile as the forms I make now. I had a huge learning
curve and when I was to the point I am now, the work I did beforehand
was less than satisfactory. The old forms required a lot of rework. I
would like to avoid this rework in WPF. I want to learn the standard
practices up-front.
Any links to good resources would be greatly appreciated. I am willing
to do the work to get on top of things. Mostly, I would like to see
the suggested example above implemented. It is basic enough that it
shouldn't be difficult to implement, but complex enough to give me the
general idea. I know it would require a lot of work, but I'd be super
appreciative.
Thanks,
Travis
I have been trying to learn the basics about WPF. I am comfortable
with binding to other control properties and binding to XML, but I
have been having a lot of trouble binding to data objects (which is
really all I care about). I need some pointers. I thought if someone
could show me an example it would help me.
The example I would like to see:
I would like to have a form that has a collection of Person. Person
would be a class with the properties of Name and Age. There can be
multiple people in the collection. How I populate the collection is
irrelevant at this point (I'll probably just hard-code it).
I would like the form to provide a text box and a button for entering
in, say an Age. The button click event would populate the collection
with people under the given age.
I would to display all the people in a grid. I would also like there
to be two text boxes below that held the name and age of the currently
selected person. When you select a different person from the grid,
that person's information would show up below in the text boxes. When
you change a value in the text boxes below, it would update the grid's
data.
That's the simple example I want. In Windows Forms it was easy to do
this. You simply created a BindingSource and set its DataSource
property to a BindingList<Person>. You populated the BindingList in
order for the Form to show the people. You had Person implement
INotifyPropertyChanged. I am assuming it is just as easy in WPF. I
simply haven't found an example that really lays it out. Maybe I have
been looking in the wrong place.
I have been watching MS' webcasts and they have been illuminating. I
have been visiting tons of web sites. I have been finding good
tutorials and examples, but none that work with data objects in the
way I am looking for.
I made a lot of Windows Forms before I truly understood what I was
doing. I wasted a lot of time making forms that, while functional,
were not as versatile as the forms I make now. I had a huge learning
curve and when I was to the point I am now, the work I did beforehand
was less than satisfactory. The old forms required a lot of rework. I
would like to avoid this rework in WPF. I want to learn the standard
practices up-front.
Any links to good resources would be greatly appreciated. I am willing
to do the work to get on top of things. Mostly, I would like to see
the suggested example above implemented. It is basic enough that it
shouldn't be difficult to implement, but complex enough to give me the
general idea. I know it would require a lot of work, but I'd be super
appreciative.
Thanks,
Travis