Edit this page

Filtering column showing DateTime values

Items disappear when a column is filtered over a DateTime property

When a column is filtered over a DateTime property and its Time part is not explicitly set, the default 00:00:00 value is used. Thus, if the bound items have different values for the Time portion of the DateTime property, they will be filtered out.

Since DateTime values with different time parts are not equal, you will have no match.

Solution 1

Trim the time part of your DateTimes.

Solution 2

The user can be instructed to enter both the date and time parts of the date when filtering.

Solution 3

Bind the column directly to the Date (or Year) property of the DateTime object.

For example: DataMemberBinding="{Binding BirthDate.Date}"

Columns bound to the Date part of a Nullable DateTime does not support filtering, as a Nullable DateTime does not expose a Date property.

As alternative solution, you can benefit from a property called FilterMemberPath. You can use it to tell the column to filter on a property different from the one it displays in its cells.

For example: FilterMemberPath="BirthDate.Date". You can also check the FilterMemberPath documentation.

See Also