[英]How to stop a multiline textbox from moving the GridSplitter?
重現該問題:(例如)向一個字母發送垃圾郵件,直到您開始點擊右側的拆分網格區域為止。 網格分割器移動到右側最小寬度限制之外。
預期的行為:在文本框中鍵入(鍵入/粘貼)時超過寬度限制不會移動網格分割器,而是會立即激活滾動條。
條件
碼:
<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>
多數民眾贊成在引起問題
<ColumnDefinition Width="10000*" MinWidth="25"/>
請為欄定義使用百分比值:
<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.