I need set Orientation to ListBox in C# code. I need the same result like this XAML code:
<ListBox>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
I have this:
ListBox elementListBox = new ListBox();
StackPanel pomocnyStackPanel = new StackPanel();
pomocnyStackPanel.Orientation = Orientation.Horizontal;
How to add "ItemsPanel"?