Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I bind to properties of the ViewModel and properties of collection items in the ViewModel?
    primarykey
    data
    text
    <p>I'll try and explain this as best as I can...</p> <p>I'm just trying to make sense of views, view models and presenters so I created a little program to illustrate some of the ins and outs. My small application basically stores albums. The albums are listed in a combo box and I have fields for artist, genre and year, which are all text boxes. Up until now, no problems... I created a binding source and bound it to the view model (which has properties for title, artist, genre and year) and it works as expected. I can cycle through the combo box and the various text boxes will change depending on the combo box selection.</p> <p>I then decided I wanted to add a list of songs for each album, so I added a new songs property to the view model and added a data grid view to the view. This is where I became quite confused. If I bind the binding source I used for everything else to the data grid view, it obviously just wants to render the immediate fields of the view model (basically repeating what I'm displaying in the text boxes, only in a grid format).</p> <p>Assuming I described the problem adequately enough, what can I do to display the album fields in the text boxes and the songs in the data grid view? I think I've come to the conclusion that I simply need a second binding source, but I'd like to avoid it if possible. I've attempted obvious things like directing the DataMember property of the data grid view to "Songs" (the property name of the songs collection in the view model) without any luck.</p> <p>Could anyone point me in the right direction?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload