Reputation: 2912
I want to put two labels in one row, the first being aligned to the left border, the second to the right.
Like here:
Here is my XAML try:
<Window x:Class="MyTestNamespace.MyXAML"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006">
<DockPanel>
<Label Content="left text" DockPanel.Dock="Left"></Label>
<Label Content="right text" DockPanel.Dock="Right"></Label>
</DockPanel>
</Window>
But instead I get this:
Upvotes: 0
Views: 1494
Reputation: 5366
You used the dockpanel correct but you need align the the label content to right. Try this
<DockPanel>
<Label Content="left text" DockPanel.Dock="Left"></Label>
<Label Content="right text" DockPanel.Dock="Right" HorizontalContentAlignment="Right"></Label>
</DockPanel>
Upvotes: 2