我还是 VS、C# 和 XAML 的新手。我在下面有这段代码
<Window x:Class="KANASoft___Xplora.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
WindowStartupLocation="CenterScreen" Icon="folder.gif" ResizeMode="CanResizeWithGrip"
Title="KANASoft - Xplora" Height="700" Width="535" Background="Black" Name="mainWindow">
<Grid Height="{Binding ElementName=mainWindow, Path=Height}" Width="{Binding ElementName=mainWindow, Path=Width}">
<ListBox Background="Black" Name="LBHeader" BorderBrush="Aqua" ScrollViewer.HorizontalScrollBarVisibility="Disabled" BorderThickness="0 0 0 1" Height="80" VerticalAlignment="Top">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" Width="{Binding ElementName=mainWindow, Path=Width}"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
</Grid>
</Window>
我希望<ListBox Name="LBHeader">
在调整窗口大小时根据窗口的宽度调整大小,并且当我通过拖动窗口边缘来调整窗口大小时它可以正常工作。但问题是,当我最大化窗口时,<ListBox Name="LBHeader">
不会随窗口调整大小。
请我在这方面需要帮助。