Hello, I would be pleased to provide an example of datetime data type handling on SfDataGrid. Direct display and editing.
Many thanks.
<sfDataGrid:SfDataGrid x:Name="sfDataGrid"
AllowEditing="True"
SelectionMode="Single"
NavigationMode="Cell"
ItemsSource="{Binding OrdersInfo}"
ColumnSizer="None"
AutoGenerateColumns="True">
<sfDataGrid:SfDataGrid.Columns>
<sfDataGrid:GridTextColumn MappingName="OrderID" />
<sfDataGrid:GridTextColumn MappingName="EmployeeID" />
<sfDataGrid:GridTextColumn MappingName="CustomerID" />
<sfDataGrid:GridDateTimeColumn MappingName="ShippingDate"/>
</sfDataGrid:SfDataGrid.Columns>
</sfDataGrid:SfDataGrid>
|
<sfgrid:SfDataGrid.Columns>
<sfgrid:GridDateTimeColumn Format="d"
HeaderText="Shipped Date"
MappingName="ShippingDate" />
</sfgrid:SfDataGrid.Columns>
|
public partial class MainPage : ContentPage
{
DataView view;
public MainPage()
{
InitializeComponent();
dataGrid.CanUseViewFilter = true;
view = new DataView();
ViewModel.Records.TableName = "DT";
view.Table = ViewModel.Records;
dataGrid.ItemsSource = view;
}
public void RaiseCollectionChanged(string propName)
{
if (this.CollectionChanged != null)
this.CollectionChanged(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
}
public event NotifyCollectionChangedEventHandler CollectionChanged;
private void SearchBar_TextChanged(object sender, TextChangedEventArgs e)
{
view.RowFilter = "Column2 >= '" + e.NewTextValue + "'";
label.Text = dataGrid.GetCellValue(dataGrid.GetRecordAtRowIndex(1), "Column2").ToString();
}
}
|