none
How to Enforce the Single Selection Criterion when GridViews are Nested Inside Other GridViews

    Question

  • Here's the scenario, I have a GridView bound to a collection. For the ItemTemplate within each GridView I have another GridView because each collection has its own collection of items. Think of a calendar app where each day represents an item within the outer GridView and each appointment represents an item within an inner GridView. When I select an item within an inner GridView and then select another item within that same GridView (or day), the first item is correctly deselected because I have the selection mode as single on the inner GridViews. However, when I select an appointment on another nested GridView (another day) the first appointment selected appears to remain selected. How then can I force the single selection mode across sibling GridViews? And thanks.
    Wednesday, November 19, 2014 5:20 AM

Answers

  • I found the trick. Previously I had the nested grid view specified in a datatemplate.xaml file, and I could not access the events of that nested gridview. Placing the nested gridview in the main page, along with its parent gridview, allowed me to trap the SelectionChanged event of the nested gridview, and with a reference to the previous parent gridview, I was also to deselect the selected item of the previous parent gridview so that only one child gridview item ever appears as selected.
    • Marked as answer by IMOsiris Saturday, November 22, 2014 10:49 PM
    Saturday, November 22, 2014 10:49 PM