mobilecontrols-devexpress-dot-xamarinforms-dot-datagrid-023d4ae2.md
A grid column used to display and edit the time.
Namespace : DevExpress.XamarinForms.DataGrid
Assembly : DevExpress.XamarinForms.Grid.dll
NuGet Package : DevExpress.XamarinForms.Grid
public class TimeColumn :
TextColumnBase
The TimeColumn is a column in the DataGridView that displays DateTime or TimeSpan values.
When a user taps a cell, the standard iOS or Android time picker appears that allows the user to select the time.
Use the following properties to adjust column settings:
You can configure the following options related to all types of grid columns:
Use the following properties to sort and group data in the grid, and calculate cell values based on expressions:
The grid stores columns in the DataGridView.Columns collection. Depending on the AutoGenerateColumnsMode option, the grid automatically generates columns based on the bound data source, or you can add columns to the grid and associate them with data fields manually. See the following help topic for an example: Create Columns for Different Data Types.
The example below binds a TimeColumn to a TimeSpan data field.
<dxg:DataGridView ItemsSource="{Binding Path=OutlookData}">
<dxg:DataGridView.Columns>
<dxg:TimeColumn FieldName="Time"
IsTimeIconVisible="True"
TimeFormatMode="HourFormat12"/>
</dxg:DataGridView.Columns>
</dxg:DataGridView>
using System.Collections.Generic;
using System.ComponentModel;
using Xamarin.Forms;
public partial class EditingView : ContentPage {
public EditingView() {
InitializeComponent();
BindingContext = new OutlookDataRepository(300);
}
}
public class OutlookDataRepository {
public ObservableCollection<OutlookData> OutlookData { get; private set; }
public OutlookDataRepository(int rowsCount) {
OutlookData = new ObservableCollection<OutlookData>();
for (int i = 0; i < rowsCount; i++) {
OutlookData.Add(new OutlookData());
}
}
}
public class OutlookData {
public OutlookData() {
Time = TimeSpan.FromMinutes(new Random().Next(24 * 60));
}
public virtual TimeSpan Time { get; set; }
}
Object GridColumn TextColumnBase TimeColumn
See Also