我正在設計一個簡單的登錄窗口,我非常想知道這一點。如何直接對wpf文本框進行排序?
好了,這是我的XAML代碼
<Grid ShowGridLines="False">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<DockPanel Grid.Row="0">
<Label x:Name="label_ID" Height="30"/>
<TextBox x:Name="textBox_ID" Height="20" TabIndex="0">
<TextBox.Margin>
<Thickness Right="5"/>
</TextBox.Margin>
</TextBox>
</DockPanel>
<DockPanel Grid.Row="1">
<Label x:Name="label_PW" Height="30"/>
<PasswordBox x:Name="textBox_PW" Height="20" TabIndex="1">
<PasswordBox.Margin>
<Thickness Right="5"/>
</PasswordBox.Margin>
</PasswordBox>
</DockPanel>
<DockPanel Grid.Row="2">
<Label x:Name="label_IP" Height="30"/>
<TextBox x:Name="textBox_IP" Height="20" UndoLimit="2">
<TextBox.Margin>
<Thickness Right="5"/>
</TextBox.Margin>
</TextBox>
</DockPanel>
</Grid>
label_ID的字符串是ID
label_PW的字符串是Password
label_IP的字符串是 'IP'
和輸出是這樣的:
https://www.dropbox.com/s/k23ft06layp0sl4/1.PNG?dl=0
密碼文本框只有其他的短。 (我想短另一個文本框。)
我該如何修復文本框的位置?
謝謝。
哇多麼完美的答案。非常感謝。 – Lee 2014-09-01 18:19:10
不客氣。只是一個小的評論:至少我猜,UndoLimit =「2」看起來像是一個「錯字」,應該是TabIndex =「2」。 – qqbenq 2014-09-01 19:08:34
是的,我看到:)謝謝。 – Lee 2014-09-02 05:33:39