Esempio n. 1
0
 public static void AddAGVInDec(string key, AdaptiveGridView instance)
 {
     if (!AdaptiveGridViewMap.ContainsKey(key))
     {
         AdaptiveGridViewMap.Add(key, instance);
     }
 }
Esempio n. 2
0
 private void SelectionChanged(AdaptiveGridView adaptativeGridView)
 {
     SelectedItemsCount = adaptativeGridView.SelectedItems.Count == 1
         ? Constants.CommandBarCoutItemKey.GetLocalized()
         : string.Format(Constants.CommandBarCoutItemsKey.GetLocalized(), adaptativeGridView.SelectedItems.Count);
     IsMultiselectionEnable = adaptativeGridView.SelectedItems.Any();
 }
Esempio n. 3
0
 /// <summary>Gets the current grid.</summary>
 private void GetCurrentGrid()
 {
     TheGrid            = ((CreateObjectsPivot.SelectedItem as PivotItem).Content as Grid).Children;
     ActionGrid         = TheGrid[0] as Grid;
     LoadingProgressBar = TheGrid[1] as ProgressBar;
     Collection         = TheGrid[2] as AdaptiveGridView;
     SmokeGrid          = TheGrid[3] as Grid;
     SmokeGridChild     = ((SmokeGrid.Children[0] as Grid).Children[0] as StackPanel).Children[0] as Grid;
 }
Esempio n. 4
0
        private void SetAnimation(Product product, AdaptiveGridView grid)
        {
            if (product == null || grid == null)
            {
                return;
            }

            grid.PrepareConnectedAnimation("anim", product, product.Image);
            ViewModel.ViewProductDetails(product);
        }
 public async void OnXamlRendered(FrameworkElement control)
 {
     adaptiveGridViewControl = control.FindDescendantByName("AdaptiveGridViewcontrol") as AdaptiveGridView;
     if (adaptiveGridViewControl != null)
     {
         adaptiveGridViewControl.ItemsSource       = await new Data.PhotosDataSource().GetItemsAsync();
         adaptiveGridViewControl.ItemClick        += AdaptiveGridViewControl_ItemClick;
         adaptiveGridViewControl.SelectionChanged += AdaptiveGridViewControl_SelectionChanged;
     }
 }
Esempio n. 6
0
        private void SetAnimation(ItemViewModel itemViewModel, AdaptiveGridView grid)
        {
            if (itemViewModel == null || grid == null)
            {
                return;
            }

            grid.PrepareConnectedAnimation(Constants.ConnectedAnimationKey, itemViewModel, "SourceImage");
            itemViewModel.Edit();
            LastSelectedItem = itemViewModel;
        }
Esempio n. 7
0
        public void Convert_DefaultAdaptiveGridView_ReturnsHeightPlusItemMargin()
        {
            var    converter = new AdaptiveHeightValueConverter();
            double value     = 100;
            var    gridView  = new AdaptiveGridView();
            var    margin    = (Thickness)gridView.ItemContainerStyle?.Setters.OfType <Setter>().First(s => s.Property == FrameworkElement.MarginProperty).Value;

            var result = converter.Convert(value, null, gridView, null);

            Assert.AreEqual(result, value + margin.Bottom);
        }
Esempio n. 8
0
        public void Convert_GridViewWithNoItemContainerStyleAndNoItems_ReturnsHeightPlusDefaultItemMargin()
        {
            var    converter = new AdaptiveHeightValueConverter();
            double value     = 100;
            var    gridView  = new AdaptiveGridView {
                ItemContainerStyle = null
            };
            var result = converter.Convert(value, null, gridView, null);

            Assert.AreEqual(result, value + converter.DefaultItemMargin.Bottom + converter.DefaultItemMargin.Top);
        }
        public async void OnXamlRendered(FrameworkElement control)
        {
            adaptiveGridViewControl = control.FindChildByName("AdaptiveGridViewControl") as AdaptiveGridView;
            loadingControl          = control.FindDescendantByName("LoadingControl") as Loading;
            loadingContentControl   = control.FindChildByName("LoadingContentControl") as ContentControl;
            resources = control.Resources;

            if (adaptiveGridViewControl != null)
            {
                adaptiveGridViewControl.ItemsSource = await new Data.PhotosDataSource().GetItemsAsync();
            }
        }
Esempio n. 10
0
 public PhotoAlbum()
 {
     this.InitializeComponent();
     PAPageName        = PhotoAlbumViewer;
     gv                = FileList;
     context           = RightClickContextMenu;
     gridContext       = GridRightClickContextMenu;
     AddItemBox        = AddDialog;
     NameBox           = NameDialog;
     inputFromRename   = RenameInput;
     ShareItem.Click  += Interaction.ShareItem_Click;
     RenameItem.Click += Interaction.RenameItem_Click;
 }
Esempio n. 11
0
        public void Convert_GridViewWithPadding_ReturnsHeightPlusPadding()
        {
            var converter = new AdaptiveHeightValueConverter {
                DefaultItemMargin = new Thickness(0)
            };
            double value    = 100;
            var    gridView = new AdaptiveGridView {
                ItemContainerStyle = null, Padding = new Thickness(10)
            };
            var result = converter.Convert(value, null, gridView, null);

            Assert.AreEqual(result, value + gridView.Padding.Bottom + gridView.Padding.Top);
        }
Esempio n. 12
0
        public void Convert_GridViewWithItemContainerStyle_ReturnsHeightPlusItemMargin()
        {
            var    converter = new AdaptiveHeightValueConverter();
            double value     = 100;
            var    gridView  = new AdaptiveGridView();

            var margin = new Thickness(10);
            var style  = new Style(typeof(GridViewItem));

            style.Setters.Add(new Setter(GridViewItem.MarginProperty, margin));
            gridView.ItemContainerStyle = style;

            var result = converter.Convert(value, null, gridView, null);

            Assert.AreEqual(result, value + margin.Bottom + margin.Top);
        }
Esempio n. 13
0
 public async void OnXamlRendered(FrameworkElement control)
 {
     _adaptiveGridViewControl = control.FindDescendantByName("AdaptiveGridViewControl") as AdaptiveGridView;
     if (_adaptiveGridViewControl != null)
     {
         var allPhotos = await new Data.PhotosDataSource().GetItemsAsync();
         _originalPhotos = allPhotos.ToArray();
         _boundPhotos    = new ObservableCollection <PhotoDataItem>(_originalPhotos);
         _adaptiveGridViewControl.ItemsSource       = _boundPhotos;
         _adaptiveGridViewControl.ItemClick        += AdaptiveGridViewControl_ItemClick;
         _adaptiveGridViewControl.SelectionChanged += AdaptiveGridViewControl_SelectionChanged;
         NumberSlider.Minimum       = 1;
         NumberSlider.Maximum       = _originalPhotos.Length;
         NumberSlider.Value         = _originalPhotos.Length;
         NumberSlider.ValueChanged += OnNumberSliderValueChanged;
     }
 }
        private void AdaptiveGridViewControl_RightTapped(object sender, RightTappedRoutedEventArgs e)
        {
            AdaptiveGridView agv = sender as AdaptiveGridView;

            if (agv.SelectionMode == ListViewSelectionMode.None)  //GridView:多选
            {
                if (e.OriginalSource is FrameworkElement element) //获取控件元素
                {
                    if (element.DataContext is PhotoFile file)
                    {
                        if (file.isAdd == Visibility.Collapsed)
                        {
                            RightPhotoFile = file;

                            Point p = e.GetPosition(agv);
                            GridView_MenuFlyout.ShowAt(agv, p);//显示
                        }
                    }
                }
            }
        }
Esempio n. 15
0
        private void OnLoaded(AdaptiveGridView adaptiveGrid)
        {
            IsMultiselectionEnable = false;

            if (adaptiveGrid == null || LastSelectedItem == null)
            {
                return;
            }

            var selectedItem = Items.FirstOrDefault(item => item.Item.Id == LastSelectedItem.Item.Id);

            if (selectedItem == null)
            {
                return;
            }

            ConnectedAnimation animation = ConnectedAnimationService.GetForCurrentView().GetAnimation(Constants.ConnectedAnimationKey);

            if (animation != null)
            {
                adaptiveGrid.ScrollIntoView(selectedItem, ScrollIntoViewAlignment.Default);
                adaptiveGrid.UpdateLayout();

                var containerObject = adaptiveGrid.ContainerFromItem(selectedItem);

                if (containerObject is GridViewItem container)
                {
                    var root  = (FrameworkElement)container.ContentTemplateRoot;
                    var image = (Image)root.FindName("SourceImage");
                    animation.TryStart(image);
                }
                else
                {
                    animation.Cancel();
                }
            }

            LastSelectedItem = null;
        }
Esempio n. 16
0
 public async Task Initialize(AdaptiveGridView gridView)
 {
     _adaptiveGridView = gridView;
     await LoadDataAsync();
 }
Esempio n. 17
0
 private void CancelSelection(AdaptiveGridView adaptativeGridView)
 {
     adaptativeGridView.DeselectRange(new ItemIndexRange(0, (uint)Items.Count));
 }
Esempio n. 18
0
 public void ShowDetail(ItemViewModel itemViewModel, AdaptiveGridView grid)
 {
     SetAnimation(itemViewModel, grid);
 }
 public void Initialize(AdaptiveGridView gridView, HN.Controls.ImageEx detailImageEx)
 {
     _adaptiveGridView = gridView;
     _detailImageEx    = detailImageEx;
 }