I have a Textcolumn displaying Date and Time(Whose datetype is DateTimeOffset) in XAMGrid. I am unable to filter that column. I am binding the xamgrid through MVVM pattern.
I am using FilterRowTop Filtering in XAMGrid.
I tried changing DateTimeOffset to datetime,then applying ValueConverter, it still doesnt work. Is there any way to convert dateTime to string on UI or any other approach
HeaderText="Start Date" HeaderTextHorizontalAlignment="Center" HorizontalContentAlignment="Center" IsFixable="False" IsSummable="False" IsFilterable="True" >
You can use TextColumn’s ValueConverter to configure how the value is displayed in the column. In this scenario, when you use filtering, you should also use the TextColumn’s EditorValueConverter and its ConvertBack method to convert the value back to DateTimeOffset.
Please find an attached sample application which uses this approach.
Sincerely,NickEntry-Level Software Developer
It still didn't filter the datetime(dateimeOffset) binded to text column, As i can able to see the records but unable to filter records based on Date . I don't want to edit the cell value.
Thank you for your feedback.
The sample filters if exact string is provided as a filter operand. If you want to use DateimeOffset and filter it, I will suggest creating your own filter. This topic describes how to achieve this:
Additionally if you use DateTime you can also use a TemplateColumn. You can display the Date value as a string (inside a TexBlock for example) on each row and use the DatePicker in the filter to filter a Date. You can find a sample of this functionality.