コード例 #1
0
        protected override void PrepareContainerForItemOverride(Windows.UI.Xaml.DependencyObject element, object item)
        {
            i++;
            MediaViewModel       MediaViewModel;
            ViewedVideoViewModel viewedVideo;

            VLC_WINRT.ViewModels.MainPage.MusicLibraryViewModel.AlbumItem albumItem;
            MediaViewModel = item as MediaViewModel;
            viewedVideo    = item as ViewedVideoViewModel;
            albumItem      = item as VLC_WINRT.ViewModels.MainPage.MusicLibraryViewModel.AlbumItem;

            if (viewedVideo != null)
            {
                if (viewedVideo.Duration.TotalSeconds > viewedVideo.TimeWatched.TotalSeconds / 2 && i == 0)
                {
                    element.SetValue(VariableSizedWrapGrid.ColumnSpanProperty, 2);
                    element.SetValue(VariableSizedWrapGrid.RowSpanProperty, 2);
                }
            }
            else if (MediaViewModel != null || albumItem != null)
            {
                if (i == 0)
                {
                    element.SetValue(VariableSizedWrapGrid.ColumnSpanProperty, 2);
                    element.SetValue(VariableSizedWrapGrid.RowSpanProperty, 2);
                }
            }
            base.PrepareContainerForItemOverride(element, item);
        }
コード例 #2
0
        protected override void PrepareContainerForItemOverride(Windows.UI.Xaml.DependencyObject element, object item)
        {
            try
            {
                dynamic _Item = item;
                element.SetValue(Windows.UI.Xaml.Controls.VariableSizedWrapGrid.ColumnSpanProperty, _Item.ColSpan);
                element.SetValue(Windows.UI.Xaml.Controls.VariableSizedWrapGrid.RowSpanProperty, _Item.RowSpan);

                if ((item is InfoHub.Articles.WeatherArticle) ||
                    (item is InfoHub.Articles.CalendarArticle))
                {
                    var _DataViewItem = (element as Windows.UI.Xaml.Controls.GridViewItem);
                    _DataViewItem.IsHitTestVisible = false;
                }
            }
            catch
            {
                element.SetValue(Windows.UI.Xaml.Controls.VariableSizedWrapGrid.ColumnSpanProperty, 1);
                element.SetValue(Windows.UI.Xaml.Controls.VariableSizedWrapGrid.RowSpanProperty, 1);
            }
            finally
            {
                base.PrepareContainerForItemOverride(element, item);
            }
        }
コード例 #3
0
ファイル: GridView.cs プロジェクト: prabaprakash/Media-Player
        protected override void PrepareContainerForItemOverride(Windows.UI.Xaml.DependencyObject element, object item)
        {
            //try
            //{
            //    dynamic _Item = item;
            //    element.SetValue(Windows.UI.Xaml.Controls.VariableSizedWrapGrid.ColumnSpanProperty, _Item.ColSpan);
            //    element.SetValue(Windows.UI.Xaml.Controls.VariableSizedWrapGrid.RowSpanProperty, _Item.RowSpan);

            //}
            //catch
            //{
            //    element.SetValue(Windows.UI.Xaml.Controls.VariableSizedWrapGrid.ColumnSpanProperty, 1);
            //    element.SetValue(Windows.UI.Xaml.Controls.VariableSizedWrapGrid.RowSpanProperty, 1);
            //}
            //finally
            //{
            //    base.PrepareContainerForItemOverride(element, item);
            //}
            //Dynamically Loaded The VariableSizeWrapGrid
            try
            {
                dynamic dynamic = item;
                element.SetValue(Windows.UI.Xaml.Controls.VariableSizedWrapGrid.ColumnSpanProperty, dynamic.ColSpan);
                element.SetValue(Windows.UI.Xaml.Controls.VariableSizedWrapGrid.RowSpanProperty, dynamic.RowSpan);
            }
            catch
            {
                element.SetValue(Windows.UI.Xaml.Controls.VariableSizedWrapGrid.ColumnSpanProperty, 1);
                element.SetValue(Windows.UI.Xaml.Controls.VariableSizedWrapGrid.RowSpanProperty, 1);
            }
            finally
            {
                base.PrepareContainerForItemOverride(element, item);
            }
        }
コード例 #4
0
        protected override void PrepareContainerForItemOverride(Windows.UI.Xaml.DependencyObject element, object item)
        {
            var viewModel = item as SampleDataItem;

            element.SetValue(VariableSizedWrapGrid.ColumnSpanProperty, viewModel.ColSpan);
            element.SetValue(VariableSizedWrapGrid.RowSpanProperty, viewModel.RowSpan);
            base.PrepareContainerForItemOverride(element, item);
        }
コード例 #5
0
 protected override void PrepareContainerForItemOverride(Windows.UI.Xaml.DependencyObject element, object item)
 {
     try
     {
         dynamic _Item = item;
         element.SetValue(Windows.UI.Xaml.Controls.VariableSizedWrapGrid.ColumnSpanProperty, _Item.ColSpan);
         element.SetValue(Windows.UI.Xaml.Controls.VariableSizedWrapGrid.RowSpanProperty, _Item.RowSpan);
     }
     catch
     {
         element.SetValue(Windows.UI.Xaml.Controls.VariableSizedWrapGrid.ColumnSpanProperty, 1);
         element.SetValue(Windows.UI.Xaml.Controls.VariableSizedWrapGrid.RowSpanProperty, 1);
     }
     finally
     {
         base.PrepareContainerForItemOverride(element, item);
     }
 }
コード例 #6
0
 protected override void PrepareContainerForItemOverride(Windows.UI.Xaml.DependencyObject element, object item)
 {
     try
     {
         dynamic _Item = item;
         element.SetValue(Windows.UI.Xaml.Controls.GridViewItem.WidthProperty, _Item.ColSpan);
         element.SetValue(Windows.UI.Xaml.Controls.GridViewItem.HeightProperty, _Item.RowSpan);;
         element.SetValue(Windows.UI.Xaml.Controls.VariableSizedWrapGrid.ColumnSpanProperty, _Item.ColSpan);
         element.SetValue(Windows.UI.Xaml.Controls.VariableSizedWrapGrid.RowSpanProperty, _Item.RowSpan);
     }
     catch
     {
         throw new Exception("Unable to set ColSpan or RowSpan from Item");
     }
     finally
     {
         base.PrepareContainerForItemOverride(element, item);
     }
 }
コード例 #7
0
 protected override void PrepareContainerForItemOverride(Windows.UI.Xaml.DependencyObject element, object item)
 {
     try
     {
         dynamic gridItem = item;
         var typeItem = item as CommonType;
         if (typeItem != null)
         {
             var heightPecentage = (300.0 / typeItem.WbmImage.PixelHeight);
             var itemWidth = typeItem.WbmImage.PixelWidth * heightPecentage;
             var columnSpan = Convert.ToInt32(itemWidth / 10.0);
             if (gridItem != null)
             {
                 element.SetValue(VariableSizedWrapGrid.ItemWidthProperty, itemWidth);
                 element.SetValue(VariableSizedWrapGrid.ColumnSpanProperty, columnSpan);
                 element.SetValue(VariableSizedWrapGrid.RowSpanProperty, 1);
             }
         }
     }
     catch
     {
         element.SetValue(VariableSizedWrapGrid.ItemWidthProperty, 100);
         element.SetValue(VariableSizedWrapGrid.ColumnSpanProperty, 1);
         element.SetValue(VariableSizedWrapGrid.RowSpanProperty, 1);
     }
     finally
     {
         base.PrepareContainerForItemOverride(element, item);
     }
 }
コード例 #8
0
        protected override void PrepareContainerForItemOverride(Windows.UI.Xaml.DependencyObject element, object item)
        {
            var itemdetail = item as SimpleItem;

            if (itemdetail != null)
            {
                if (itemdetail.Type.Equals(ItemType.Ellipse) ||
                    itemdetail.Type.Equals(ItemType.Rectangle))
                {
                    element.SetValue(VariableSizedWrapGrid.ColumnSpanProperty, 2.0);
                }
            }
            base.PrepareContainerForItemOverride(element, item);
        }