WPF小記——DockPanel使用不當引發界面顯示問題

使用如下代碼,當TextBlock文本過長,引發Button的顯示位置在可見區域之外:spa

 1 <Window x:Class="WpfApplication11.MainWindow"
 2         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 3         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 4         Title="MainWindow" Height="200" Width="200">
 5    
 6     <DockPanel>
 7         <TextBlock Text="edrftgyhjnjmkfvtygbhunjiuhibygtvhnjukiytgvfbyhnj" TextTrimming="CharacterEllipsis"/>
 8         <Button Content="Button" Width="100" DockPanel.Dock="Right"/>
 9     </DockPanel>
10 </Window>

【END】code

相關文章
相關標籤/搜索