|
|
1
12
蛮力:
编辑: 1,2的代码将存在于您的代码中。 对于1,您可以执行如下操作:
对于2,在CollectionChanged处理程序中,您可以执行如下操作:
编辑2: 但是,在这种情况下,我会 强烈地 建议您也检查listcollectionview.needsrefresh,如果设置了,则只刷新。如果您的属性发生了不影响排序的更改,则没有理由重新排序。 |
|
|
2
0
这是可行的。每当集合更改时,它会对集合重新排序。也许可以以更有效的方式实现,但这就是其中的要点。
XAML: <Window x:Class="ServiceManager.TestWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="TestWindow" Height="500" Width="500">
<DockPanel>
<ListBox ItemsSource="{Binding}" x:Name="lstbox">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Label Content="{Binding Path=A}"/>
<Label Content="{Binding Path=B}"/>
<Label Content="{Binding Path=C}"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Button Click="Button_Click" Content="Click" />
</DockPanel>
</Window>
|
|
|
user1702369 · 模型中的IEnumerable可观察 7 年前 |
|
|
pyriame · 沙马林。表单:输入一个字符后取消焦点输入 8 年前 |
|
|
Losec · 使用命令过滤ObservableCollection 8 年前 |
|
|
Riyas · 如何更新可观察集合组 8 年前 |