private void SearchCheckedTagsButton_Click(object sender, RoutedEventArgs e) { var tags = MarkedTagList.ItemContainerGenerator.Items .Select(x => MarkedTagList.ItemContainerGenerator.ContainerFromItem(x)) .OfType <FrameworkElement>() .Select(x => ViusalTreeHelperEx.FindName("SelectCheckBox", x)) .OfType <CheckBox>() .Where(x => x.IsChecked ?? false) .Select(x => x.DataContext) .OfType <TagRecord>() .Select(x => x.Tag.Name).ToArray(); if (!tags.Any()) { Toast.ShowMessage("请至少选择一项标签"); return; } var gallery = Container.Default.GetExportedValues <Gallery>().Where(x => GalleriesSelector.SelectedItem.ToString() == x.GalleryName).FirstOrDefault(); if (gallery == null) { Toast.ShowMessage("请选择有效的画廊"); return; } NavigationHelper.NavigationPush(new MainGalleryPage(tags, gallery)); }
private void SearchCheckedTagsButton_Click(object sender, RoutedEventArgs e) { var tags = TagViewList.ItemContainerGenerator.Items .Select(x => TagViewList.ItemContainerGenerator.ContainerFromItem(x)) .OfType <FrameworkElement>() .Select(x => ViusalTreeHelperEx.FindName("SelectCheckBox", x)) .OfType <CheckBox>() .Where(x => x.IsChecked ?? false) .Select(x => x.DataContext) .OfType <TagRecord>() .Select(x => x.Tag).ToArray(); if (!tags.Any()) { Toast.ShowMessage("请至少选择一项标签"); return; } RequestSearchEvent?.Invoke(tags); }
private void SearchCheckedTagsButton_Click(object sender, RoutedEventArgs e) { var tags = MarkedTagList.ItemContainerGenerator.Items .Select(x => MarkedTagList.ItemContainerGenerator.ContainerFromItem(x)) .OfType <FrameworkElement>() .Select(x => ViusalTreeHelperEx.FindName("SelectCheckBox", x)) .OfType <CheckBox>() .Where(x => x.IsChecked ?? false) .Select(x => x.DataContext) .OfType <TagRecord>() .Select(x => x.Tag.Name).ToArray(); if (!tags.Any()) { Toast.ShowMessage("请至少选择一项标签"); return; } NavigationHelper.NavigationPush(new MainGalleryPage(tags)); }