How add a ItemsPanel dynamically to listbox.
- by Subhen
Hi,
I have a list Box which contains few Images in the itemsTemplate , like below:
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel x:Name="stackPanelItems" Orientation="Horizontal">
<Image Source="{Binding strAlbumcoverImage}"
Height="40" Width="40"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
Now onClick of a button I want to change the view and for that I want to add the wrap panel to the ListBox ItemsPanelas following:
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<controlsToolkit:WrapPanel></controlsToolkit:WrapPanel>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
Do I need to define the ItemsPanel Style in App.XAML and then assign it. Not quite sure about it.
Thanks,
Subhen