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
Attempt to call InvalidateArrange on wrong LayoutManager exception is get, when trying to move item from ItemsControl in one window to the ItemsContron in other window
#12753
Open
ArsenAbazian opened this issue
Sep 1, 2023
· 3 comments
Describe the bug
There are two similar windows with ItemsControl in them. In first window ItemsControl contains one item, for example: Button. In one moment the button is removed from the current ItemsControl.Items collection and added to the ItemsControl.Items in ItemsControl, located in other window. After that if you try to resize the first window, an "Attempt to call InvalidateArrange on wrong LayoutManager" exception will be thrown.
To Reproduce
Create two windows (Window1, Window2), with ItemsControl in each window.
In Window1 constructor create and add Button1 button to Window1.ItemsControl.
Add button (Button2) to Window1 and handle click event.
On Button2.Click event handler write code to remove Button1 from Window1.ItemsControl and add Button1 to Window2.ItemsControl
Resize Window1
Exception is thrown
Expected behavior
No exception is thrown, Button1 successfully appear in Window2 and disappear from Window1
Desktop (please complete the following information):
OS: Windows 11
Avalonia version: 11.0.4
Additional context
I added the sample project, demonstating the issue. Please run the sample project and press the "Move Item To Main Window Container" button in FloatingWindow. Notice that button is not moved to MainWidow and stays in FloatingWindow. Then try to resize FloatingWindow.
As a workaround try to call the UpdateLayout method after removing the button from first ItemsControl. AvaloniaApplication1.zip
Thank you,
Arsen.
The text was updated successfully, but these errors were encountered:
Describe the bug
There are two similar windows with ItemsControl in them. In first window ItemsControl contains one item, for example: Button. In one moment the button is removed from the current ItemsControl.Items collection and added to the ItemsControl.Items in ItemsControl, located in other window. After that if you try to resize the first window, an "Attempt to call InvalidateArrange on wrong LayoutManager" exception will be thrown.
To Reproduce
Expected behavior
No exception is thrown, Button1 successfully appear in Window2 and disappear from Window1
Desktop (please complete the following information):
OS: Windows 11
Avalonia version: 11.0.4
Additional context
I added the sample project, demonstating the issue. Please run the sample project and press the "Move Item To Main Window Container" button in FloatingWindow. Notice that button is not moved to MainWidow and stays in FloatingWindow. Then try to resize FloatingWindow.
As a workaround try to call the UpdateLayout method after removing the button from first ItemsControl.
AvaloniaApplication1.zip
Thank you,
Arsen.
The text was updated successfully, but these errors were encountered: