andreasg
Topic Author
Posts: 10
Joined: 22 Nov 2013, 08:44

Missing ItemsControl.IsItemItsOwnContainerOverride

22 Feb 2016, 12:39

I'm in the need of the ItemsControl.IsItemItsOwnContainerOverride.
I got a couple of UIElements that I want to 'dress up' with a DataTemplate.

Maybe there is some other way to do this? (I don't want to write a specific style for each find of UIElement)
 
User avatar
sfernandez
Site Admin
Posts: 2991
Joined: 22 Dec 2011, 19:20

Re: Missing ItemsControl.IsItemItsOwnContainerOverride

26 Feb 2016, 13:11

The method ItemsControl.IsItemItsOwnContainerOverride should be overriden if you are creating a new ItemsControl class to specify its own container class (the default is ContentPresenter for ItemsControl, ListBoxItem for ListBox, etc.).

Unfortunately this virtual method is only available in the native API yet, and not in the C# API. We will fix these as part of the work in 1.2.8 (support for custom user control).

If you only want to specify different data templates depending on the type of data, you can use the DataTemplate.DataType property and let the automatic template selection to choose the right template for your data. An example can be found here: http://www.thejoyofcode.com/different_d ... types.aspx

If this is not your case, could you please elaborate a bit more what you want to do?

Who is online

Users browsing this forum: Ahrefs [Bot], Dmirty, Google [Bot], Semrush [Bot] and 6 guests