private void recipeList_SelectionChanged(object sender, MouseButtonEventArgs e) { var index = recipeList.SelectedIndex; if (index >= 0 && index < data.Count) { Recipe r = data[index]; var detail = new UserControlDetail(r); detail.Show(); detail.Topmost = true; } }
private void recipeList_MouseDown(object sender, MouseButtonEventArgs e) { StackPanel panel = sender as StackPanel; if (panel != null) { Recipe recipe = panel.DataContext as Recipe; if (recipe != null) { var detail = new UserControlDetail(recipe); detail.Show(); detail.Topmost = true; } } }