<Grid x:Name="grid_1" Grid.Row="0" Margin="7, 7, 7, 50" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" > <TextBox x:Name="txtPONumbersStr" HorizontalAlignment="Center" TextWrapping="Wrap" VerticalAlignment="Top" Text="{Binding Path = PONumbersStr, Mode=TwoWay}" InputMethod.IsInputMethodEnabled ="False" PreviewTextInput="TextBox_PONumbersStr_PreviewTextInput" IsEnabled="{Binding Path=IsEnabled}" Width="{Binding ElementName=grid, Path=ActualWidth}" Height="{Binding ElementName=grid, Path=ActualHeight}" /> </Grid>, 调整代码, 使得TextBox的边框显示出来
时间: 2024-02-14 19:04:13 浏览: 330
可以在TextBox标签中添加一个Border标签,并将TextBox放在其中,代码如下:
```
<Grid x:Name="grid_1" Grid.Row="0" Margin="7, 7, 7, 50" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
<Border BorderThickness="1" BorderBrush="Black">
<TextBox x:Name="txtPONumbersStr"
HorizontalAlignment="Center"
TextWrapping="Wrap"
VerticalAlignment="Top"
Text="{Binding Path = PONumbersStr, Mode=TwoWay}"
InputMethod.IsInputMethodEnabled ="False"
PreviewTextInput="TextBox_PONumbersStr_PreviewTextInput"
IsEnabled="{Binding Path=IsEnabled}"
Width="{Binding ElementName=grid, Path=ActualWidth}"
Height="{Binding ElementName=grid, Path=ActualHeight}" />
</Border>
</Grid>
```
在Border标签中设置BorderThickness和BorderBrush属性来定义边框的样式,可以根据需要进行调整。
阅读全文