How to change element in ItemsSource without also changing SelectedIndex #18676
mkj-stonehill
started this conversation in
General
Replies: 1 comment
-
There is currently a fairly relevant PR open which might be worth looking at. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've got an application using Avalonia 11.2.7. I have a ListBox:
If
ModuleList
is anObservableCollection<string>
, then if I change the string for the currently selected item like this:Then I find that
SelectedModule
gets changed to -1 (meaning I lose the current selection).If I change
ModuleList
to a simpleList<string>
, I can change the selected item, but the ListBox does not update on the screen, even if I include a call toRaisePropertyChanged(nameof(ModuleList))
.Is there any way to accomplish this? In other words, I'd like to update the string displayed for the selected item, without losing the current selected index value.
Beta Was this translation helpful? Give feedback.
All reactions