在listview
中,我使用Wrappanel
作为ItemsPanelTemplate
<ListView ItemsSource="{Binding TodoItemViewModels}"
ScrollViewer.VerticalScrollBarVisibility="Disabled"
Drop="Card_Drop"
AllowDrop="True"
DragLeave="Card_DragLeave"
IsEnabled="{Binding Disable, ElementName=root}"
Background="Green">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Margin="0" Orientation="Vertical" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<!-- Displaying Cards in CardCollection View -->
<ListView.ItemTemplate>
<DataTemplate>
<Border BorderThickness="2"
BorderBrush="BlanchedAlmond"
Opacity="1"
Background="BlanchedAlmond"
Width="25" Height="30"
MouseMove="Card_MouseMove"
CornerRadius="5"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<TextBlock Text="{Binding Cardstr}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Foreground="{Binding Cardclr}"
Background="BlanchedAlmond" />
</Border>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
我如何修复Listview
,这样如果我移除一个项目,它的位置将会有一个空的位置,而不是列表重新排列,如下面的img所示:
after removing an item个
我试过Wrapanel
和Gridview
都不能正常工作.
我不想在网格中一个接一个地插入单元格,因为这会使程序复杂化