You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not sure if this is an "issue" or a "discussion", so let's start here.
I'm having a bit of trouble with a TabControl and the Avalonia.Xaml.Interactions.Draggable behaviour (but I've tracked it down to an issue within the Avalonia codebase, rather than the Interactions codebase, fundamentally). Specifically, when a currently selected tab is dragged (other than the first one, i.e. index 0), the tab control content flickers as the tab item order is adjusted.
What's happening is that the ItemsControl is recognising the movement as two separate events: a removal and an insertion. When the currently selected tab is removed, the SelectingItemsControl changes the currently selected index to 0, and then after the insertion the Draggable behaviour sets the currently selected index to the drag target index. In between these events, the UI updates, flashes to the index 0 tab, and then back to the selected tab.
Now, at first I thought this was because the ItemDragBehavior.MoveDraggedItem method was using the two separate calls for RemoveAt and Insert, but even when I alter it to account for the fact I'm using an ObservableCollection<> and use the Move method on that container, the process is still registered as two separate events.
This is the bit that's I'm struggling with, as the ObservableCollection<> expressly models the move operation with a single NotifyCollectionChangedEventArgs with NotifyCollectionChangedAction.Move, but as far as I can tell (although I'm struggling to pinpoint exactly where) the Avalonia ItemsControl/SelectingItemsControl is unpacking that single event into two changes, which is then causing it to not respect Move as a single operation from a UI perspective (hence the flicker).
I can see two possible directions:
Change the way ItemsControl/SelectingItemsControl responds to move events
Somehow prevent UI visual updates during the switch
And I can't figure out how to do either. I'm also open to other suggestions. So far I've messed around with the internals of ItemDragBehavior.MoveDraggedItem (to use Move) and ObservableCollection<>.MoveItem (to report the change as a series of replacements, rather than a move - it was a wild notion that did not work), to no avail.
I would appreciate any wisdom. It's a small thing, but that flicker is really annoying me.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello all,
Not sure if this is an "issue" or a "discussion", so let's start here.
I'm having a bit of trouble with a
TabControl
and theAvalonia.Xaml.Interactions.Draggable
behaviour (but I've tracked it down to an issue within the Avalonia codebase, rather than the Interactions codebase, fundamentally). Specifically, when a currently selected tab is dragged (other than the first one, i.e. index 0), the tab control content flickers as the tab item order is adjusted.What's happening is that the
ItemsControl
is recognising the movement as two separate events: a removal and an insertion. When the currently selected tab is removed, theSelectingItemsControl
changes the currently selected index to 0, and then after the insertion the Draggable behaviour sets the currently selected index to the drag target index. In between these events, the UI updates, flashes to the index 0 tab, and then back to the selected tab.Now, at first I thought this was because the
ItemDragBehavior.MoveDraggedItem
method was using the two separate calls forRemoveAt
andInsert
, but even when I alter it to account for the fact I'm using anObservableCollection<>
and use theMove
method on that container, the process is still registered as two separate events.This is the bit that's I'm struggling with, as the
ObservableCollection<>
expressly models the move operation with a singleNotifyCollectionChangedEventArgs
withNotifyCollectionChangedAction.Move
, but as far as I can tell (although I'm struggling to pinpoint exactly where) the AvaloniaItemsControl
/SelectingItemsControl
is unpacking that single event into two changes, which is then causing it to not respectMove
as a single operation from a UI perspective (hence the flicker).I can see two possible directions:
ItemsControl
/SelectingItemsControl
responds to move eventsAnd I can't figure out how to do either. I'm also open to other suggestions. So far I've messed around with the internals of
ItemDragBehavior.MoveDraggedItem
(to useMove
) andObservableCollection<>.MoveItem
(to report the change as a series of replacements, rather than a move - it was a wild notion that did not work), to no avail.I would appreciate any wisdom. It's a small thing, but that flicker is really annoying me.
Beta Was this translation helpful? Give feedback.
All reactions