Every ItemsControl
has its content stored in Panel right ? We can specify the panel to be used in XAML like this:
<ListView Name="LView">
<ListView.ItemsPanel>
<ItemsPanelTemplate >
<StackPanel/>
</ItemsPanelTemplate>
</ListView.ItemsPanel>
</ListView>
My question is how to get instance of Panel
that is used in the ItemsPanel
property (of type ItemsPanelTemplate
) of the particular ItemsControl
? For example ListView
called LView
from above code sample?
I cannot use Name
property or x:Name
, this must work for any ItemsControl
even those using default ItemsPanel
.
In the case its not clear please comment, I think there is very simple solution. If it seems to be complicated that's only because I cannot explain it properly.
ItemsControl
or from one of the item templates inside it? – HydrobombItemsPanelTemplate
exactly. I definitely don't want to get it from item templates. – Potion