The RadCardView control's API does not provide an event, which occurs when the ItemsSource property is changed. However, you could achieve the desired result, by adding an additional event handler to the ItemsSource property. For example, this logic could be implemented inside the Loaded event of the RadCardView control. In it, the ItemsSource property could be retrieved by using the GetProperties static method of the TypeDescriptor class. On the returned PropertyDescriptor class, utilize its AddValueChanged method, and as a first parameter pass the RadCardView control instance, and for the second, an event in which the expand and collapse logic could be implemented.
The following code snippets show the Loaded event as well as the newly added event handler's implementation:
this.cardView.Loaded += CardView_Loaded;
privatevoidCardView_Loaded(object sender, RoutedEventArgs e)
var cardViewSender = (RadCardView)sender;
var itemsSourceProperty = TypeDescriptor.GetProperties(cardViewSender)["ItemsSource"];
itemsSourceProperty.AddValueChanged(cardViewSender, new EventHandler(CardView_ItemsSourceChanged));
With that said, I have attached a sample project, so, could you give it a try?
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.