It's been working with SelectedItem but I've got what seems to be a race condition between two events and sometimes the selected item is not correct. I'm collapsing all of the detailpanels and then either showing or hiding the detail panel that was just clicked, at the same time as using the selected item to filter the results for a datagrid within the details panel. the net result is that sometimes the wrong row gets the data or worse I end up with a Layout loop (seems to be on the datagrids that have a lot of rows).
I can't use the datacontext from the row as the data is on the viewmodel itself (property uses linq query to filter the results for the row selected). I think a better way to do this would be the classic master slave, where I have a single grid or list and the selected item decides what to populate in a slave datagrid. that's the behaviour we wanted except that the slave datagrid is show in the row's detail panel (selecting another row via toggle button in another row collapses all other rows and shows the row clicked). Doesnt explain why expanding some of the larger rows gives me a layout loop exception but that could be a different issue (or maybe even a weird bug in the datagrid?) I know there used to be a limit on the number of textboxes you could show on a page, but I read that was fixed in SL3. thanks for the replies, Stephen On Mon, Apr 12, 2010 at 8:38 PM, Miguel Madero <[email protected]> wrote: > Stephen, > > Could you provide more details about it? An example of the collection of > itemssources. The Details Panel already has the same DataContext as the row. > I don't understand what you want to do? Is it just a child colleciton and > for some reason you want it to use the same index as the parent row? > > Could the VisualTreeHelper or a Converter help? > > On Mon, Apr 12, 2010 at 8:56 PM, ross <[email protected]> wrote: > >> Maybe you need to take a different approach. >> >> You could bind the SelectedItem property of the grid to an appropriate >> property on whatever class is supplying your ItemsSource / >> datacontext, depending on how you have it coded. Your details panel >> could bind to the same property as well, or if it is more complex you >> could use it as a hook to do what ever you need, such as update >> whatever it is your details panel binds against in the setter perhaps. >> >> Another, less elegant option is to handle the SelectionChanged event >> of the grid and then use the SelectionChangedEventArgs.AddedItems >> property to give you a hook as to what the new selected item is, which >> can then be used to set the datacontext of your details panel. >> >> >> On Mon, Apr 12, 2010 at 7:45 PM, Stephen Price <[email protected]> >> wrote: >> > Hey all, >> > Will someone put me out of my misery and tell me how I can easily get >> the >> > index of a row in a datagrid? I can't believe there's no way to iterate >> > through the rows in a datagrid. Have been banging my head against a wall >> all >> > afternoon and I'm done. >> > What I actually want to do is set the datacontext of each Details panel >> of >> > my datagrid (more specifically another datagrid within each detailpanel) >> to >> > the same index item as the row. ie collection of itemsources with each >> > itemsource being set to the collection[index] that matches that row's >> index. >> > hopefully that makes sense to someone. >> > thanks :) >> > Stephen >> > _______________________________________________ >> > ozsilverlight mailing list >> > [email protected] >> > http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight >> > >> > >> _______________________________________________ >> ozsilverlight mailing list >> [email protected] >> http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight >> > > > > -- > Miguel A. Madero Reyes > www.miguelmadero.com (blog) > [email protected] > > _______________________________________________ > ozsilverlight mailing list > [email protected] > http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight > >
_______________________________________________ ozsilverlight mailing list [email protected] http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
