WPF RadGridView Cannot apply advanced filters to grid

1 Answer 52 Views
GridView
Chris
Top achievements
Rank 1
Iron
Chris asked on 24 Nov 2021, 03:27 AM

I have a RadGridView in our project. I can filter the Property in the ViewModel, and the Grid updates. I can click the column filter and use the check boxes and it filters down to just those items - awesome.

However, the Column filter also has a section of, "Show rows with value that..." where you can say it equals something, is greater than, starts with, etc. In the text box, when I enter the value, as soon as I tab away the value just gets cleared.

Now, this is a project with lots of competing themes & legacy code etc. I setup a new project with just the RadGridView and a basic ViewModel and it worked perfectly. So I'm assuming there's some conflict somewhere that's occurring, I just don't have the first idea on where to start looking for it.

Is there any hint you can give me? E.g. What is the textbox binding to? Anything would be great.

Dilyan Traykov
Telerik team
commented on 26 Nov 2021, 02:50 PM

Hello Chris,
It is also hard for me to determine a particular cause for this issue without being able to replicate it at my end.
A good starting point for troubleshooting would be to check whether any binding errors are shown in the Output window of Visual Studio. You can also enable the CLR exceptions and see if any are thrown when you perform the problematic filtering.
As for your question - the field filter editors bind to the property defined as the DataMemberBinding of the column unless the FilterMemberPath property is specified. You can handle the FieldFilterEditorCreated event to check the created controls for any discrepancies and possibly customize them.
Please let me know how all of this goes.

1 Answer, 1 is accepted

Sort by
0
Accepted
Chris
Top achievements
Rank 1
Iron
answered on 01 Dec 2021, 03:07 AM | edited on 01 Dec 2021, 03:17 AM

Thanks. Managed to figure it out by just experimenting with deleting various bits of code.

Ages ago we had a problem with WPF that if you had your Binding as PropertyChanged, and your binding has a String Format on it. When the control lost focus it wouldn't reapply the string format. I don't know if this is still an issue or not.

Anyway, our solution was to use EventManager.RegisterClassHandler on the LostFocus event and if the binding's UpdateSourceTrigger wasn't OnLostFocus to call UpdateTarget.

Adding a case for TextBoxes where its Trigger is "Default" (which for textboxes is the same as LostFocus) fixed it.

I assume we got the idea from StackOverflow so hopefully this will help anyone else with a similar issue.

Dilyan Traykov
Telerik team
commented on 01 Dec 2021, 03:47 PM

I'm glad to hear that you've managed to resolve the issue.

Also, I'd like to thank you for taking the time to share your solution with our community.

As for the binding issue you mentioned, I cannot find such a bug report in our feedback portal. If you would provide more details on it, possibly by sharing the ticket ID of the case when you first observed it, I may be able to provide more information.
Chris
Top achievements
Rank 1
Iron
commented on 01 Dec 2021, 09:53 PM

Hi, the problem was with WPF not Telerek. We wrote the bit of code well before we started using telerik.

The following outlines the issue fairly well. I'm not sure if I would call it a bug... but it wasn't the behaviour we wanted - converter - Problem with UpdateSourceTrigger=PropertyChanged and StringFormat in WPF - Stack Overflow

Chris
Top achievements
Rank 1
Iron
commented on 01 Dec 2021, 10:54 PM

I just did a quick test. This was "Fixed" in .NET 4.0 - but the new behaviour was worse. It applies the string format on each keypress, so if your string format is c or 0.00, then entering 5.50 results in 5.50.00
Dilyan Traykov
Telerik team
commented on 02 Dec 2021, 12:31 PM

Thank you for the additional details.
As this goes beyond our scope of support, I do hope you're satisfied with the current approach for handling this scenario.
Do let me know if I can further assist you with anything else.
Tags
GridView
Asked by
Chris
Top achievements
Rank 1
Iron
Answers by
Chris
Top achievements
Rank 1
Iron
Share this question
or