-
Notifications
You must be signed in to change notification settings - Fork 118
Description
Related to #26
Discovered as part of work on DataTable experiment in labs in this branch/commit here: CommunityToolkit/Labs-Windows@47f46df#diff-b874aea5366fbeacbd08eec0606a72bf3b458be31ff250be121b9c9f5ec7b49d
Basically, when the target control was being set in this scenario, the layout hadn't occurred yet on the, so the DesiredSize.Width is still '0'; which means the Width of the component is set to 0 and is never updated or changed making it invisible.
Instead, if the DesiredSize is not set yet, then we shouldn't manipulate the Width of the control, as the patch above did.
We set the Width property is that's modified by the sizing behavior:
Windows/components/Sizers/src/ContentSizer/ContentSizer.Events.cs
Lines 36 to 50 in 744e6ab
| protected override bool OnDragHorizontal(double horizontalChange) | |
| { | |
| if (TargetControl == null) | |
| { | |
| return true; | |
| } | |
| horizontalChange = IsDragInverted ? -horizontalChange : horizontalChange; | |
| if (!IsValidWidth(TargetControl, _currentSize + horizontalChange, ActualWidth)) | |
| { | |
| return false; | |
| } | |
| TargetControl.Width = _currentSize + horizontalChange; |
However, when we start to drag we measure the ActualWidth (or Height) here:
Windows/components/Sizers/src/ContentSizer/ContentSizer.Events.cs
Lines 24 to 33 in 744e6ab
| protected override void OnDragStarting() | |
| { | |
| if (TargetControl != null) | |
| { | |
| _currentSize = | |
| Orientation == Orientation.Vertical ? | |
| TargetControl.ActualWidth : | |
| TargetControl.ActualHeight; | |
| } | |
| } |
So, in theory we may just be able to remove this initial code all together?
Metadata
Metadata
Assignees
Labels
Type
Projects
Status