tags:

views:

1764

answers:

2
+3  A: 

I can't see your image (it's blocked by my company's firewall), but here I go anyways...

Your 'Orientation="Horizontal"' is probably working as it should: it only contains one child element, an ItemsControl. Instead, try making a ControlTemplate for your ItemsControl, where the ControlTemplate contains a StackPanel with Orientation="Horizontal".

Hope this helps!

Edit:

Once again, Bea comes through with an answer/example!

http://bea.stollnitz.com/blog/?p=10

Pwninstein
+1 for the Bea reference.
Bryan Anderson
+2  A: 

I would say it looks like the ItemsControl is what is displaying the buttons vertically. if you want the buttons in the itemsControl to be horizontal, then you need the StackPanel to be in the ItemsControl ItemsPanelTemplate, not the other way round like what you have in your code:

<ItemsControl IsTabStop="False" ItemsSource="{Binding Path=BranchCommands}">
    <ItemsControl.ItemTemplate>
        <DataTemplate>
            <Button Tag="{Binding}" Padding="3">
                <TextBlock Text="{Binding Path=DisplayValue}" />
            </Button>
        </DataTemplate>
    </ItemsControl.ItemTemplate>
    <ItemsControl.ItemsPanel>
        <ItemsPanelTemplate>
            <StackPanel Orientation="Horizontal"/>
        </ItemsPanelTemplate>
    <ItemsControl.ItemsPanel>
</ItemsControl>

I might be slightly wrong on the ItemsControl.ItemsPanel bit as I haven't got any data to test it with...

Edit: In addition to the Bea reference, there's some good stuff by Dr WPF.

Dave Arkell
This did it!!! Thanks for the answer, and I've bookmarked Bea's site as well. Thanks everyone! This was starting to bug me quite a bit, lol.
James McConnell