Trouble with assigning a Custom Filter to RadListView in C++

3 Answers 54 Views
ListView
Zaven Alexander
Top achievements
Rank 2
Iron
Zaven Alexander asked on 02 Nov 2023, 03:25 PM

Hello, 

I'm trying to set up a custom filter for a ListView set in Icon Mode.

Following along with the example provided here: https://docs.telerik.com/devtools/winforms/controls/listview/features/filtering

I've created the following function (no actual filtering functionality has been added yet):

//Apply the filters to the RadListView
bool BrightLife::FilterDatabase(ListViewDataItem^ item)
{

	//Filter by Tree View

	//Filter by Search Bar

	//Filter by Color

	//Filter by Style

	return false;
}

Then, in the constructor of my form, I have the following:

this->LV_Assets->EnableFiltering = true;
this->LV_Assets->ListViewElement->DataView->Filter = FilterDatabase; //<- Problem here

The line which assigns the filter to the RadListView is returning an error in Visual Studio

function "Telerik::WinControls::Data::RadCollectionView<TDataItem>::Filter::set [with TDataItem=Telerik::WinControls::UI::ListViewDataItem ^]" cannot be called with the given argument

I'm not entirely sure what the problem is here and would appreciate any insight to help me get this working. Thanks!

3 Answers, 1 is accepted

Sort by
1
Accepted
Dinko | Tech Support Engineer
Telerik team
answered on 08 Nov 2023, 08:07 AM

Hi Zaven,

The provided project is greatly appreciated.

After trying several things which I have tried, I think the following syntax is the way to set custom predicate in C++:

this->radListView1->ListViewElement->DataView->Filter = gcnew Predicate<ListViewDataItem^>(this, &Form1::MyFilter2);

I am also attaching the sample project. I hope that you can continue with the development process of your application.

Regards,
Dinko | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Zaven Alexander
Top achievements
Rank 2
Iron
commented on 08 Nov 2023, 06:43 PM

Hi Dinko, I can confirm that this has fixed the problem!

Thank you very much! 


1
Dinko | Tech Support Engineer
Telerik team
answered on 06 Nov 2023, 12:58 PM

Hello Zaven Alexander,

Thank you for your interest in our RadListView for WinForms control.

Upon checking our backlog, we are not aware of such an exception when using the filter functionality of the control. I have also tried to follow your steps but still, no error appears on my side. Now I am not quite familiar with the C++ syntax in this case and my test project is written in C#, however, such an exception shouldn't be raised. Maybe I am missing some settings applied to the control. Could it be possible to isolate this behavior in a standalone project and send it back to me? I will do my best to examine it and try to find what is causing this exception. 

I am also attaching my test project so that you can check it out.

Regards,
Dinko | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

0
Zaven Alexander
Top achievements
Rank 2
Iron
answered on 07 Nov 2023, 01:34 PM

Hi Dinko,

Thank you for spending the time investigating this issue. I can confirm that the sample project you sent me is working correctly, and it seems that C++ is the culprit here. 

I've attached a standalone C++ project, as requested, with the problem I'm encountering. The Form1.h is where the relevant code can be found found. 

Fingers crossed you're able to find a solution!

Thanks!

Tags
ListView
Asked by
Zaven Alexander
Top achievements
Rank 2
Iron
Answers by
Dinko | Tech Support Engineer
Telerik team
Zaven Alexander
Top achievements
Rank 2
Iron
Share this question
or