Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="XFDataGridControl"/> class.
 /// </summary>
 public XFDataGridControl()
 {
     _mParent = new Grid {
         RowSpacing = 0, ColumnSpacing = 0
     };
     _gridHeader           = new XFGridHeader(this);
     _gridItemBody         = new XFGridBody(this);
     _gridHelper           = new XFGridHelper();
     this.PropertyChanged += XFDataGridControl_PropertyChanged;
 }
Ejemplo n.º 2
0
        private void CreateGridHeader()
        {
            this.BackgroundColor = BorderColor;
            var count = ColumnSource != null ? ColumnSource.Count : XFGridHelper.GetPropCount(ItemSource);

            this.ColumnDefinitions = new ColumnDefinitionCollection();
            for (int i = 0; i < count; i++)
            {
                this.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = GridLength.Star
                });
            }
            this.RowDefinitions = new RowDefinitionCollection
            {
                new RowDefinition {
                    Height = HeaderHeight
                },
                new RowDefinition {
                    Height = 5
                }
            };
            if (ColumnSource == null || ColumnSource.Count == 0)
            {
                CreateDeafultHeader();
            }
            else
            {
                CreateGridColumnHeader();
            }
            BoxView v = new BoxView {
                BackgroundColor = BorderColor
            };

            this.Children.Add(v, 0, 1);
            SetColumnSpan(v, count);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// The GetRowGrid.
        /// </summary>
        /// <returns>The <see cref="Grid"/>.</returns>
        private Grid GetRowGrid()
        {
            var grid = new Grid {
                RowSpacing = BorderWidth, ColumnSpacing = BorderWidth
            };

            grid.ColumnDefinitions = new ColumnDefinitionCollection();
            var count = _parent.ColumnsSource != null ? _parent.ColumnsSource.Count : XFGridHelper.GetPropCount(GridItemSource);

            for (int i = 0; i < count; i++)
            {
                grid.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = GridLength.Star
                });
            }
            grid.RowDefinitions = new RowDefinitionCollection
            {
                new RowDefinition {
                    Height = RowHeight
                },
                new RowDefinition {
                    Height = BorderWidth
                }
            };
            return(grid);
        }