I have this WPF button in my StackPanel:
<StackPanel Grid.ColumnSpan="6" Grid.Row="12" Orientation="Horizontal" HorizontalAlignment="Stretch" VerticalAlignment="Center" Background="LightGray" Height="40">
<Button x:Name="btnSave" Click="btnSave_Click" Content="{x:Static res:Strings.ToolPanelEditView_Button_Save}" HorizontalAlignment="Right" />
</StackPanel>
For some reason, the button shows on the left although I set its HorizontalAlignment
to Right
:
How can I make my save button show on the right?
P.S. when I change the StackPanel's HorizontalAlignment
to Right
instead of Stretch
, the button does show on the right like it should (but then the gray background of the StackPanel does not stretch either...