FilterRowTop Filtering is not working on Xamgrid for TextColumn?

Not Answered This post has 0 verified answers | 3 Replies | 2 Followers Thread's RSS feed.

V
Points 40
Replied On: Wed, Oct 11 2017 6:38 AM Reply

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" >

  • Post Points: 20

All Replies

Nick
Points 1,840
Infragistics Employee
Replied On: Thu, Oct 12 2017 4:00 AM Reply

Hello,

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,
Nick
Entry-Level Software Developer

  • Post Points: 20
V
Points 40
Replied On: Thu, Oct 12 2017 8:45 AM Reply

Hi,

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.

  • Post Points: 20
Nick
Points 1,840
Infragistics Employee
Replied On: Fri, Oct 13 2017 11:09 AM Reply

Hello,

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:

https://www.infragistics.com/help/wpf/xamgrid-create-a-custom-filter

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.

Sincerely,
Nick
Entry-Level Software Developer

  • Post Points: 5
Page 1 of 1 (4 items) | RSS