private void HiddenPlayList_ItemClick(object sender, ItemClickEventArgs e) { SearchSongsForDisplay select_Item = e.ClickedItem as SearchSongsForDisplay; String[] arr = new String[4]; arr[0] = select_Item.Name; arr[1] = select_Item.Artist; arr[2] = select_Item.AlName; arr[3] = select_Item.Length; bool flag = true; List <Grid> list = new List <Grid>(); FindChildren <Grid>(list, HiddenPlayList); for (int i = 0; i < list.Count; i++) { if (list[i].Children.Count != 6) { continue; } flag = true; for (int j = 0; j < 4; j++) { TextBlock textBlock = list[i].Children[j] as TextBlock; if (textBlock != null) { if (arr[j] != textBlock.Text) { flag = false; } } } Grid gridBtn1 = list[i].Children[4] as Grid; Grid gridBtn2 = list[i].Children[5] as Grid; if (gridBtn1 != null && gridBtn1 != null) { if (flag) { Button btn1 = gridBtn1.Children[0] as Button; Button btn2 = gridBtn2.Children[0] as Button; btn1.IsEnabled = true; btn2.IsEnabled = true; gridBtn1.Opacity = 1; gridBtn2.Opacity = 1; } else { Button btn1 = gridBtn1.Children[0] as Button; Button btn2 = gridBtn2.Children[0] as Button; btn1.IsEnabled = false; btn2.IsEnabled = false; gridBtn1.Opacity = 0; gridBtn2.Opacity = 0; } } } }
private void PlayBtn_Click(object sender, RoutedEventArgs e) { SearchSongsForDisplay selectItem = HiddenPlayList.SelectedItem as SearchSongsForDisplay; playingVm.addToPlayingList(selectItem); }