Пример #1
0
 /// <summary>
 /// The ApplyHeaderTextStyle.
 /// </summary>
 /// <param name="label">The label<see cref="HeaderLabel"/>.</param>
 private void ApplyHeaderTextStyle(HeaderLabel label)
 {
     if (_parent.GridHeaderStyle != null)
     {
         label.TextColor = _parent.GridHeaderStyle.TextColor;
         label.HorizontalTextAlignment = _parent.GridHeaderStyle.HorizontalTextAlignment;
         label.VerticalTextAlignment   = _parent.GridHeaderStyle.VerticalTextAlignment;
         label.FontSize       = _parent.GridHeaderStyle.FontSize;
         label.FontAttributes = _parent.GridHeaderStyle.FontAttributes;
         label.FontFamily     = _parent.GridHeaderStyle.FontFamily;
     }
 }
Пример #2
0
        private Label GetHeaderLabel(XFGridColumn gridcolumn)
        {
            var propLabel = new HeaderLabel
            {
                BackgroundColor = HeaderColor,
                Text            = gridcolumn.PropertyName,
                FontAttributes  = FontAttributes.Bold,
                ColumnObj       = gridcolumn
            };
            var sortGesture = new TapGestureRecognizer
            {
                CommandParameter = gridcolumn
            };

            sortGesture.Tapped -= SortGesture_Tapped;
            sortGesture.Tapped += SortGesture_Tapped;
            propLabel.GestureRecognizers.Add(sortGesture);
            return(propLabel);
        }
Пример #3
0
        public DataTemplate CreateTemplate()
        {
            var listTemplate = new DataTemplate(() =>
            {
                var grid             = GetRowGrid();
                grid.BackgroundColor = _parent.GridBorderColor;
                var column           = 0;
                foreach (var headercolumn in _parent._gridHeader.Children)
                {
                    HeaderLabel _headerLabel = headercolumn as HeaderLabel;
                    if (_headerLabel == null)
                    {
                        break;
                    }
                    var propLabel = new Label();
                    propLabel.SetBinding(Label.TextProperty, _headerLabel.ColumnObj.PropertyName);
                    propLabel.BackgroundColor = _parent.GridBackgroundColor;
                    grid.Children.Add(propLabel, column, 0);
                    var tapGestureRecognizer = new TapGestureRecognizer
                    {
                        NumberOfTapsRequired = 2,
                        CommandParameter     = _headerLabel.ColumnObj.PropertyName
                    };
                    tapGestureRecognizer.Tapped -= TapGestureRecognizer_Tapped;
                    tapGestureRecognizer.Tapped += TapGestureRecognizer_Tapped;
                    propLabel.GestureRecognizers.Add(tapGestureRecognizer);
                    column++;
                }
                BoxView bv = new BoxView {
                    HeightRequest = 5, BackgroundColor = _parent.GridBorderColor
                };
                grid.Children.Add(bv, 0, 1);
                Grid.SetColumnSpan(bv, column);
                return(new ViewCell {
                    View = grid
                });
            });

            return(listTemplate);
        }