I have ListView with Grid as ItemsPanel:
<ListView Name="listView" Width="21cm" Height="29.7cm"><ListView.Template><ControlTemplate><ItemsPresenter /></ControlTemplate></ListView.Template><ListView.ItemsPanel><ItemsPanelTemplate><Grid Name="theGrid" ShowGridLines="True" IsItemsHost="True" Background="White"/></ItemsPanelTemplate></ListView.ItemsPanel><ListView.ItemTemplate><DataTemplate><Label Content="{Binding InnerView.Entity.Name}" HorizontalAlignment="Center" VerticalAlignment="Center"/></DataTemplate></ListView.ItemTemplate><ListView.ItemContainerStyle><Style><Setter Property="Grid.Column" Value="{Binding Column}" /><Setter Property="Grid.Row" Value="{Binding Row}" /></Style></ListView.ItemContainerStyle></ListView>
My question: is it possible to access ItemsPanelTemplate in code somehow and add columns and rows my Grid (Named "theGrid") programmatically before theGrid is created?
(theGrid is created just after ListView.Measure() is called, see my previous post http://social.msdn.microsoft.com/Forums/en-US/c3bc450e-6cb9-43de-8eb9-3caac24bb8f6/listviewitemspanel-is-not-created?forum=wpf)
Dmitriano http://developernote.com