Does anybody know how i can determine if itemscontrol panel has been generated?
I am building a custom control that contains itemscontrol with Grid set as ites panel and cant figure out the proper way to obtain the itemscontrol panel from code behind.
Control Template
<Style TargetType="{x:Type local:DayTimeRange}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:DayTimeRange}">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<ItemsControl
Name="PART_ItemsControl"
AlternationCount="1"
IsEnabled="{Binding HasTimeRange,RelativeSource={RelativeSource AncestorType=local:DayTimeRange}}">
<ItemsControl.ItemContainerStyle>
<Style>
<Setter Property="Grid.Row" Value="{Binding GridRow,Mode=OneWay}" />
<Setter Property="Grid.Column" Value="{Binding GridColumn,Mode=OneWay}" />
<Setter Property="Grid.RowSpan" Value="{Binding GridRowSpan,Mode=OneWay}" />
<Setter Property="Grid.ColumnSpan" Value="{Binding GridColumnSpan,Mode=OneWay}" />
</Style>
</ItemsControl.ItemContainerStyle>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Grid x:Name="PART_Panel" IsItemsHost="True"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
So what would be the best way to get the actual Panel?