ListView.SelectedItemChanged not triggered when a LightVisualElement clicked

1 Answer 46 Views
ListView
Dave
Top achievements
Rank 2
Iron
Iron
Iron
Dave asked on 17 Dec 2023, 10:48 PM

I can't consistently have the SelectedItemChanged event called when clicking an item with a Listview in IconsView.  If a click is made in empty space, the event is triggered.  

What am I missing?

Attached is a sample app.

 Thanks,

_D

1 Answer, 1 is accepted

Sort by
0
Nadya | Tech Support Engineer
Telerik team
answered on 18 Dec 2023, 01:13 PM

Hi, Dave,

The provided project is greatly appreciated.

If I understand you correctly you expect the SelectedItemChanged event to trigger every time when clicking with the mouse over the custom IconListViewVisualItem. There are two useful properties that come in handy in such cases for handling mouse interactions. To achieve this, you should NotifyParentOnMouseInput property of your LightVisualElement to true , and ShouldHandleMouseInput to false in CreateChildElements method:

imageElement = new LightVisualElement();
imageElement.ShouldHandleMouseInput = false;
imageElement.NotifyParentOnMouseInput = true;

Please refer to the attached gif file that demonstrates the result.

I hope this helps. Should you have any other questions do not hesitate to contact me.

Regards,
Nadya | 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.

Dave
Top achievements
Rank 2
Iron
Iron
Iron
commented on 18 Dec 2023, 04:57 PM

Hi Nadya,

That is exactly what I missed. Your solution is perfect!

Thanks!

_D

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