public Scenario1()
        {
            this.InitializeComponent();

            NewItems     = SampleDataModel.GetSampleData().Where(x => x.IsNew).ToList();
            FlaggedItems = SampleDataModel.GetSampleData().Where(x => x.IsFlagged).ToList();
            AllItems     = SampleDataModel.GetSampleData().ToList();

            this.DataContext = this;
        }
Пример #2
0
        public Scenario2()
        {
            this.InitializeComponent();
            NewItems         = SampleDataModel.GetSampleData().Where(x => x.IsNew).ToList();
            FlaggedItems     = SampleDataModel.GetSampleData().Where(x => x.IsFlagged).ToList();
            AllItems         = SampleDataModel.GetSampleData().ToList();
            this.Suggestions = new ObservableCollection <SampleDataModel>();

            this.DataContext = this;
        }
        private void ListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            SampleDataModel SelectedItem = null;

            if (e.AddedItems.Count >= 1)
            {
                SelectedItem = e.AddedItems[0] as SampleDataModel;
                (sender as ListView).SelectedItem = null;
                ShowItem(SelectedItem);
            }
        }
        async private void ShowItem(SampleDataModel model)
        {
            var MyDialog = new ContentDialog();

            if (model != null)
            {
                var MyImage = new Image();
                MyImage.Source = new BitmapImage(new Uri(model.ImagePath));
                MyImage.HorizontalAlignment = HorizontalAlignment.Stretch;
                MyImage.VerticalAlignment   = VerticalAlignment.Stretch;
                MyImage.Stretch             = Windows.UI.Xaml.Media.Stretch.UniformToFill;
                MyDialog.Title   = String.Format("You have selected {0}", model.ToString());
                MyDialog.Content = MyImage;
            }
            else
            {
                MyDialog.Title = "No item found";
            }

            MyDialog.PrimaryButtonText = "OK";
            await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() => await MyDialog.ShowAsync());
        }
Пример #5
0
        private void AutoSuggestBox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
        {
            SampleDataModel FoundItem = null;

            if (args.ChosenSuggestion != null && args.ChosenSuggestion is SampleDataModel)
            {
                FoundItem = args.ChosenSuggestion as SampleDataModel;
            }
            else if (String.IsNullOrEmpty(args.QueryText) == false)
            {
                foreach (var Item in AllItems)
                {
                    if (Item.Title.Equals(args.QueryText, StringComparison.OrdinalIgnoreCase))
                    {
                        FoundItem = Item;
                        break;
                    }
                }
            }

            ShowItem(FoundItem);
        }
        async private void ShowItem(SampleDataModel model)
        {
            var MyDialog = new ContentDialog();

            if (model != null)
            {
                var MyImage = new Image();
                MyImage.Source = new BitmapImage(new Uri(model.ImagePath));
                MyImage.HorizontalAlignment = HorizontalAlignment.Stretch;
                MyImage.VerticalAlignment = VerticalAlignment.Stretch;
                MyImage.Stretch = Windows.UI.Xaml.Media.Stretch.UniformToFill;
                MyDialog.Title = String.Format("You have selected {0}", model.ToString());
                MyDialog.Content = MyImage;
            }
            else
            {
                MyDialog.Title = "No item found";

            }

            MyDialog.PrimaryButtonText = "OK";
            await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async () => await MyDialog.ShowAsync());
        }
Пример #7
0
        private void ListView_ItemClicked(object sender, ItemClickEventArgs e)
        {
            SampleDataModel SelectedItem = e.ClickedItem as SampleDataModel;

            ShowItem(SelectedItem);
        }