private void Expander_Expanded(object sender, RoutedEventArgs e) { Grid parentGrid = UIHelpers.FindVisualParent <Grid>(sender as FrameworkElement); if (parentGrid != null && parentGrid.Name == "networkConnectionGrid") { var thisView = this as ConnectionsView; ListView list = (ListView)thisView.FindName("connectionsList"); list.SelectedItem = parentGrid.DataContext; } }
protected void ItemControl_MouseUp(object sender, MouseButtonEventArgs e) { ListView parent = UIHelpers.FindVisualParent <ListView>(sender as FrameworkElement); var item = parent.SelectedItem; if (parent.SelectedItems.Count == 1) { parent.SelectedItem = null; parent.SelectedItem = item; } }