[英]How to stop a multiline textbox from moving the GridSplitter?
To reproduce the issue: Spam a letter (for example) until you start hitting the right gridsplitter area. 重现该问题:(例如)向一个字母发送垃圾邮件,直到您开始点击右侧的拆分网格区域为止。 The gridsplitter gets moved past the right side min-width limit.
网格分割器移动到右侧最小宽度限制之外。
Expected behaviour: Going over the width limit when typing (type/paste) into the textbox does not move the gridsplitter, but immediately activates the scrollbar. 预期的行为:在文本框中键入(键入/粘贴)时超过宽度限制不会移动网格分割器,而是会立即激活滚动条。
Conditions 条件
Code: 码:
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10000*" MinWidth="25"/>
<ColumnDefinition Width="8" />
<ColumnDefinition Width="*" MinWidth="25" />
</Grid.ColumnDefinitions>
<ScrollViewer HorizontalScrollBarVisibility="Visible">
<TextBox AcceptsReturn="True" AcceptsTab="True" TextWrapping="Wrap" />
</ScrollViewer>
<GridSplitter Background="Black"
BorderBrush="White"
BorderThickness="1,0,0,0"
ResizeDirection="Columns"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" Grid.Column="1" />
<Grid Background="Red" Grid.Column="2" />
</Grid>
Thats causing problems 多数民众赞成在引起问题
<ColumnDefinition Width="10000*" MinWidth="25"/>
Use percentage values for you column definition instead: 请为栏定义使用百分比值:
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".75*" MinWidth="25"/>
<ColumnDefinition Width="8" />
<ColumnDefinition Width=".25*" MinWidth="25" />
</Grid.ColumnDefinitions>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.