Wednesday, 11 September 2013

How to code Orientation of ListBox - WPF - c#

How to code Orientation of ListBox - WPF - c#

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"?

No comments:

Post a Comment