private void ArtistDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (ArtistDataGrid.SelectedIndex >= 0) { var i = ArtistDataGrid.SelectedIndex.ToString(); System.Data.DataRowView lbi = (System.Data.DataRowView)ArtistDataGrid.SelectedValue; var ArtistName = (lbi.Row[0].ToString()); labelArtistName.Content = ArtistName; string WhichArtist = ArtistName; juke_RWPF._VideoMusicjuke_RDataSet1_GroupSongByArtist _VideoMusicjuke_RDataSet1_GroupSongByArtist = ((juke_RWPF._VideoMusicjuke_RDataSet1_GroupSongByArtist)(this.FindResource("_VideoMusicjuke_RDataSet1_GroupSongByArtist"))); // Load data into the table GroupSongsByArtistqry. You can modify this code as needed. juke_RWPF._VideoMusicjuke_RDataSet1_GroupSongByArtistTableAdapters.GroupSongsByArtistqryTableAdapter _VideoMusicjuke_RDataSet1_GroupSongByArtistGroupSongsByArtistqryTableAdapter = new juke_RWPF._VideoMusicjuke_RDataSet1_GroupSongByArtistTableAdapters.GroupSongsByArtistqryTableAdapter(); _VideoMusicjuke_RDataSet1_GroupSongByArtistGroupSongsByArtistqryTableAdapter.FillBy2(_VideoMusicjuke_RDataSet1_GroupSongByArtist.GroupSongsByArtistqry, WhichArtist); System.Windows.Data.CollectionViewSource groupSongsByArtistqryViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("groupSongsByArtistqryViewSource"))); groupSongsByArtistqryViewSource.View.MoveCurrentToFirst(); { { string myArtistPic = ""; TextBlock x = SongGroupDataGrid.Columns[2].GetCellContent(SongGroupDataGrid.Items[0]) as TextBlock; if (x != null) //MessageBox.Show(x.Text); myArtistPic = x.Text; { string MyString = (x.Text); char[] MyChar = { 'g', 'p', 'm', '.', ' ' }; string NewString = MyString.TrimEnd(MyChar); string ArtistPicture = ((NewString) + (".jpg")); ImageSource imgsr = new BitmapImage(new Uri(ArtistPicture)); PictureBox1.Source = imgsr; } } } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)