Our xamwebgrid is set up to autogenerate columns as it binds dynamically to multiple datasets. When it generates columns of DateTime type it creates a DateColumn with the DatePicker. Our data is read only so we don't need the datepicker and we need the date/times to show in this format "12/31/2009 13:35:00"
If we parse the dates to string, it messes up our date sort orders as well as the formatting we apply to current records. For instance 01/01/2010 will sort before 01/07/2010.
Is there a way to remove the DatePicker from the DateColumns when the datecolumns are autogenerated?
Its the same as what i just stated.
Setting the ColumnType mappings, will solve your issue, as they determine what kind of column will be generated for a specific DataType.
-SteveZ
Hi All,
we are having similar issue with WPF XamGrid. When we define ColumnTypeMappings from C# backcode of the Page it doesn't work(defined in constructor right after InitializeComponent()).
foreach (var columnTypeMapping in PositionsDataGrid.ColumnTypeMappings)
{
if (columnTypeMapping.DataType == typeof(DateTime))
columnTypeMapping.ColumnType = typeof(TextColumn);
}
if (columnTypeMapping.DataType == typeof(DateTime?))
...
It works when we add to XAML like bellow:
<ig:XamGrid.ColumnTypeMappings>
<ig:ColumnTypeMapping ColumnType="igGrid:TextColumn" DataType="system:DateTime"/>
<ig:ColumnTypeMapping ColumnType="igGrid:TextColumn" DataType="system:Boolean"/>
</ig:XamGrid.ColumnTypeMappings>
We are binding XamGrid ItemsSource to ObservableCollection<PresentationItem>, PresentationItem has a lot of properties of a class that are nullable.
How we can define DataType attribute to be "DateTime?"(nullable DateTime) in XAML? How to define nullable DataTypes in XAML?
We are using Infragistics 16.1 version.