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
