我是WPF的新手,有一个非常简单的窗口:
<Window x:Class="xyz"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:xyz"
mc:Ignorable="d"
Height="400" Width="550" ResizeMode="NoResize"
Closing="Window_Closing">
<StackPanel Orientation="Vertical">
<Label Margin="150,0,0,0">Values are saved upon closing this window</Label>
<StackPanel Orientation="Horizontal">
<Label Width="150">User Id</Label>
<TextBox Width="380" x:Name="txtUserId" Text="{Binding Path=UserId, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}" />
</StackPanel>
</StackPanel>
</Window>
漂亮的香草...为什么文本框对于文本而言太大(高度)?
答案 0 :(得分:0)
在文本框上设置VerticalAlignment =“ Center”