tags:

views:

18

answers:

2

A have listbox

<ListBox>
    <ListBox.ItemTemplate>
    <DataTemplate>
        <DockPanel>
        <Button Content="{Binding name_trainer}" Tag="{Binding idPersonTrainer}" DockPanel.Dock="Top" HorizontalAlignment="Center">
        </Button>
        </DockPanel>
    </DataTemplate>
    </ListBox.ItemTemplate>
</ListBox>

alt text

A: 

You may have to center the DockPanel, rather than the data inside it. I've seen this behavior with StackPanel, because the panel shrinks to the contents. The centering ends up working properly, but in the wrong context.

Merlyn Morgan-Graham
dockpanel, too, is not centered
simply denis
@simply: Sorry, was just a guess :)
Merlyn Morgan-Graham
A: 
<ListBox.ItemsPanel>
    <ItemsPanelTemplate>
        <StackPanel HorizontalAlignment="Center"/>
    </ItemsPanelTemplate>
</ListBox.ItemsPanel>
simply denis