C
C#2y ago
benthris

❔ How do I cycle through different observable collections within the same collection view?

My current plan is to do something like:
List <ObservableCollection<TodoItem>> allTodoItemsLists= new List <ObservableCollection<TodoItem>>();
private ObservableCollection<TodoItem> selectedtodoItems;
public ObservableCollection<TodoItem> SelectedTodoItems { get => selectedtodoItems;
set { selectedtodoItems = value;
OnPropertyChanged();
}
}

int currentListIndex;
public int CurrentListIndex { get => currentListIndex; set{
currentListIndex=value;
SelectedTodoItems = allTodoItemsLists[currentListIndex];
}
}
List <ObservableCollection<TodoItem>> allTodoItemsLists= new List <ObservableCollection<TodoItem>>();
private ObservableCollection<TodoItem> selectedtodoItems;
public ObservableCollection<TodoItem> SelectedTodoItems { get => selectedtodoItems;
set { selectedtodoItems = value;
OnPropertyChanged();
}
}

int currentListIndex;
public int CurrentListIndex { get => currentListIndex; set{
currentListIndex=value;
SelectedTodoItems = allTodoItemsLists[currentListIndex];
}
}
Using SelectedTodoItems as the ItemSource binding within the collection view. But this seems too inelegant. Is there a better way of doing this?
1 Reply
Accord
Accord2y ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server