Xuni Product Documentation - Xamarin.Forms
Defining Columns

With automatic column generation as one of the default features of FlexGrid, the control lets you specify the columns, allowing you to choose which columns to show, and in what order. This gives you control over each column's width, heading, formatting, alignment, and other properties. To define columns for the FlexGrid, ensure that the AutoGenerateColumns is set to false (By default it is true).

The image below shows how the FlexGrid appears, after defining columns.

FlexGrid Defining Columns

The following code example demonstrates how to define FlexGrid columns in C# and XAML. The example uses the sample created in the Quick Start section.

In Code

C#
Copy Code
var data = Customer.GetCustomerList(100);
grid.ItemsSource = data;

In XAML

XAML
Copy Code
<Grid VerticalOptions="FillAndExpand">
   <xuni:FlexGrid x:Name="grid" AutoGenerateColumns="False">
      <xuni:FlexGrid.Columns>
        <xuni:GridColumn Binding="ID" Width="100"/>
        <xuni:GridColumn Binding="First"/>
        <xuni:GridColumn Binding="Last"/>
        <xuni:GridColumn Binding="Weight" Format="N1"/>
      </xuni:FlexGrid.Columns>
    </xuni:FlexGrid>
</Grid>

 

 


Copyright © GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback