示例#1
0
 /// <summary>
 /// Deletes all rows in the grid
 /// </summary>
 public void DeleteAllRows()
 {
     if (GridBody != null)
     {
         GridBody.EmptyFast();
     }
     if (Rows != null)
     {
         foreach (var gr in Rows)
         {
             if (gr.Element != null)
             {
                 gr.Element.As <JsObject>()["_GridRow"] = null;
             }
         }
         Rows.Clear();
     }
 }
示例#2
0
        public DataGrid()
        {
            RowSpacing = 0;
            RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
            RowDefinitions.Add(new RowDefinition { Height = GridLength.Star });

            // Head Grid (1)
            headGrid = new GridHead(this);
            SetRow(headGrid, 0);
            Children.Add(headGrid);

            // Stack list (3)
            stackList = new StackList(this);

            // Body Grid (2)
            bodyGrid = new GridBody(this, stackList);
            bodyGrid.VerticalOptions = LayoutOptions.Start;

            // Scroll (1)
            mainScroll = new GridScroll();
            SetRow(mainScroll, 1);
            mainScroll.Content = bodyGrid;
            this.Children.Add(mainScroll);

            // Abs bottom line
            absoluteBottom = new BoxView();
            absoluteBottom.SetBinding(Grid.BackgroundColorProperty, new Binding(nameof(BorderColor), source: this));
            absoluteBottom.SetBinding(Grid.HeightRequestProperty, new Binding(nameof(BorderWidth), source: this));
            absoluteBottom.VerticalOptions = LayoutOptions.EndAndExpand;
            absoluteBottom.HorizontalOptions = LayoutOptions.FillAndExpand;
            absoluteBottom.TranslationY = BorderWidth * 0.1;
            SetRow(absoluteBottom, 1);
            this.Children.Add(absoluteBottom);

            mainScroll.SizeChanged += CheckWrapperBottomVisible;
            stackList.SizeChanged += CheckWrapperBottomVisible;
        }
 private void KillFocus()
 {
     GridBody.Focus();
 }