C# 窗口最大化时列表框控件不调整大小
我对VS、C#和XAML还是新手。我有下面的代码C# 窗口最大化时列表框控件不调整大小,c#,xaml,C#,Xaml,我对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="CenterS
<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>
我希望在调整窗口大小时,我的
能够根据窗口的宽度调整大小,并且在通过拖动窗口边缘来调整窗口大小时效果良好。
但问题是,当我最大化窗口时,
不会随窗口调整大小
请告诉我这方面需要帮助。我搜索了你,找到了:
希望它能对您有所帮助我在搜索您时发现了以下内容:
希望它能帮助您您应该从
网格
中删除高度和宽度
属性,并且包装您应该从网格
中删除高度和宽度
属性,而WrapPanel
您应该从网格
中删除高度和宽度
属性,以及WrapPanel
@Fredy。。。你的评论应该作为答案发布,它起作用了。虽然我没有删除WrappanelTanks的宽度,但我将该注释作为回答。您应该从网格中删除高度和宽度属性,以及WrapPanel
@Fredy。。。你的评论应该作为答案发布,它起作用了。虽然我没有去掉包装箱的宽度,但我还是把这个评论作为一个答案