This question is locked. New answers and comments are not allowed.
I found the IsEnabled property on the GridViewRow, but can't figure out how to change it programmatically. I have a toggleButton in a row. When that is selected, I need to select the current row and disable all other rows and buttons. ISelectable is a simple interface that has an IsSelected boolean property. I can't access the rows from the this.playlistItemsGridView. Any suggestions?
privatevoidToggleButton_Click(objectsender, System.Windows.RoutedEventArgs e){// can only select one at time// set all isSelected to false except this one// the item must implement ISelectablevar selectedItems =this.playlistItemsGridView.Items.SourceCollection.Cast<ISelectable>().Where(element => element.IsSelected);if(selectedItems.Count() == 0){selectedItem.IsSelected =true;this.playlistItemsGridView.SelectedItem = selectedItem;}elseif((ISelectable)selectedItems.First() == selectedItem){// if the selectedItem was unchecked, set to false and returnselectedItem.IsSelected =false;this.playlistItemsGridView.SelectedItem =null;return;}else{((ISelectable)selectedItems.First()).IsSelected =false;selectedItem.IsSelected =true;this.playlistItemsGridView.SelectedItem = selectedItem;}}
