我有一个 WPF 应用程序,其中有一个网格,其中 2 列设置为 * 和自动。问题是,当我减小窗口的大小时,第二列中的子项将从右侧而不是左侧被剪切。我希望它们从左侧剪辑,因为我已将水平对齐设置为右侧。有没有办法可以剪切左侧的第二列元素?
<Window x:Class="WpfApp2.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApp2"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" MinWidth="60"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<DockPanel HorizontalAlignment="Right" Grid.Column="1">
<Button Click="Button_Click" Content="click me" Width="150" DockPanel.Dock="Right" />
<Label Content="abcdef" Width="200" DockPanel.Dock="Right" />
<Label x:Name="mLog"/>
</DockPanel>
<Button Click="Button_Click" DockPanel.Dock="Right" Content="click me" Width="150"/>
<Label Content="abcdef" Width="200" DockPanel.Dock="Right"/>
</Grid>
</Window>
红颜莎娜
呼如林
胡说叔叔
相关分类