WPF: Aligning the base line of a Label and its TextBox
Posted
by Heinzi
on Stack Overflow
See other posts from Stack Overflow
or by Heinzi
Published on 2010-06-14T17:05:20Z
Indexed on
2010/06/14
17:12 UTC
Read the original article
Hit count: 442
Let's say I have a simple TextBox next to a Label:
<StackPanel>
<StackPanel Orientation="Horizontal">
<Label Margin="3">MyLabel</Label>
<TextBox Margin="3" Width="100">MyText</TextBox>
</StackPanel>
...
</StackPanel>
This yields the following result:
As you can see, the base lines of MyLabel and MyText are not aligned, which looks ugly. Of course, I could start playing around with the margins until they match up, but since this is such a common requirement I'm sure that WPF provides a much easier and more elegant solution, which I just haven't found yet...
© Stack Overflow or respective owner