My app needs to have items in be aligned by the user; left, right and center. I am having an issue formating the app to handle this, meaning that application can either align left or right or center but not all three. How can I get the items for example 5 buttons to be aligned left, right and center changed via a button press (I should know how to do this once I am able to actual format in XMLA)?
My first thought would be do this with a dock panel;
<DockPanel MinWidth="500" Background="LightGray" Margin="20" LastChildFill="False">
<Button Margin="10" DockPanel.Dock="Left" >one</Button>
<Button Margin="10" DockPanel.Dock="Left">two</Button>
<Button Margin="10" DockPanel.Dock="Left">three</Button>
<Button Margin="10" DockPanel.Dock="Left">four</Button>
<Button Margin="10" DockPanel.Dock="Left">five</Button>
</DockPanel>
This works great for Left and right alignment. The problem is that there is no DockPanel.Dock="Center"
Next tried a Grid;
<Grid Background="LightGray" MinWidth="500">
<Button HorizontalAlignment="Left" Margin="10,10,10,10">one</Button>
<Button HorizontalAlignment="Left" Margin="10,10,10,10">two</Button>
<Button HorizontalAlignment="Left" Margin="10,10,10,10">three</Button>
<Button HorizontalAlignment="Left" Margin="10,10,10,10">four</Button>
<Button HorizontalAlignment="Left" Margin="10,10,10,10">five</Button>
</Grid>
Problem is that this happens;
edit: Apparently I didn't make the my question clear enough.
edit2: @Henka Programmer suggestion below did not work. First I believe he meant HorizontalAlignment not VerticalAlignment. With this code;
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Background="LightGray" MinWidth="500">
<Button Content="btn 01" />
<Button Content="btn 02" />
<Button Content="btn 03" />
<Button Content="btn 0" />
</StackPanel>
Gives this result;
Changing HorizontalAlignment="Right"
to HorizontalAlignment="Center"
makes no difference