如果我使用items
作为ItemsSource
它正在运行,但如果我使用sorted_items
则它不会显示在列表视图中。
ObservableCollection<myModel> items = new ObservableCollection<myModel>();
ObservableCollection<myModel> sorted_items = new ObservableCollection<myModel>();
lv_items.ItemsSource = sorted_items;
items.Add(new myModel
{
ImageSource = myImage,
Name = item_name;
});
sorted_items = items;
for (int j = 0; j < sorted_items.Count; j++)
{
sorted_items.Move(sorted_items.Count - 1, j)
}
答案 0 :(得分:4)
我的 Spidey 感觉告诉我你应该在作业后尝试移动lv_items.ItemsSource = sorted_items
,或者在for
for (int j = 0; j < sorted_items.Count; j++)
{
sorted_items.Move(sorted_items.Count - 1, j)
}
lv_items.ItemsSource = sorted_items;