Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🧪 [Experiment] SizerBase class for GridSplitter + ContentSizer + PropertySizer #101

Closed
14 of 31 tasks
michael-hawker opened this issue May 6, 2022 · 10 comments · Fixed by #102
Closed
14 of 31 tasks
Assignees
Labels
enhancement Improvement to an existing feature experiment 🧪 Used to track issues that are experiments (or their linked discussions) partner ⏹ Label for issues that are being depended on by Toolkit partners.

Comments

@michael-hawker
Copy link
Member

michael-hawker commented May 6, 2022

Approved from Discussion #96

Problem Statement (copied from Discussion):

We have various types of experience which need 'gripper bars' in order to provide a user with the ability to resize/drag an area of UI around in an application. These all have similar visual and behavior cues, but may require different logic to manipulate the underlying UI structure.

Overview

This experiment adds the following components:

  • SizerBase an abstract base class to centralize logic around input, visuals, and accessibility.
  • GridSplitter knows how to manipulate a Grid's rows/columns
  • ContentSizer knows how to manipulate the Width/Height of any FrameworkElement
  • PropertySizer knows how to directly manipulate any bound double value

SizerBase

Using

You can try it out via the NuGet Packages here:

Read more about Preview Packages here.

This control has moved from Labs to the new main repo.

CommunityToolkit members can also try it out with Codespaces.

TO DO

Not all these items are required to submit a PR. This list is here to help track what is remaining to implement before a technical review and discussion of moving into the main repository can occur.

Implementation Requirements

Tested Platforms

These items can sometimes be done ahead of time, but are usually started and completed after all implementation details are finished.

Technical Review

@michael-hawker michael-hawker added enhancement Improvement to an existing feature experiment 🧪 Used to track issues that are experiments (or their linked discussions) partner ⏹ Label for issues that are being depended on by Toolkit partners. labels May 6, 2022
@michael-hawker michael-hawker changed the title 🧪 Experiment: SizerBase class for GridSplitter + ContentSizer + PropertySizer 🧪 [Experiment] SizerBase class for GridSplitter + ContentSizer + PropertySizer May 6, 2022
@mrlacey mrlacey added this to the Initial Release milestone May 9, 2022
@michael-hawker
Copy link
Member Author

Couple of things I've noticed, looks like I broke the WASM hover implementation again... and we should investigate an auto-collapse behavior mode too.

@michael-hawker
Copy link
Member Author

michael-hawker commented Dec 2, 2022

Figured out what was going on with the cursor not properly updating when the Orientation is Horizontal (like in the sample) - regression from current Toolkit version.

It's this code here:

var cursor = gripper.ReadLocalValue(CursorProperty);
if (cursor == DependencyProperty.UnsetValue || cursor == null)
{
cursor = cursorToUse;
// On UWP, we use the extension in XAML to control this behavior,
// so we'll update it here (and maintain binding).
// We'll keep it in-sync to maintain behavior for WinUI 3 as well.
gripper.SetValue(CursorProperty, cursor);
// We return here, as the Cursor will trigger this function again anyway to set for WinUI 3
return;
}

Since we set the value of the dependency property, when the initial pass run on load sets it to SizeWestEast. Then the detection logic runs and Orientation is changed to Horizontal, but the set gets ignored the 2nd time as the prop has been set...

Think this was abstracted in the old code as the inner class held that info.

Here, I think we need to just have the private value tracking what the cursor should be and leave the Cursor property for overrides? Will think about it more and get back to it as a separate fix.

Effects UWP and WASM (basically WinUI 2), Windows App SDK uses a different setup, so I think is uneffected.

@michael-hawker
Copy link
Member Author

Behavior for WindowsAppSDK is looking good now on 1.3, will push a PR up shortly, also trying to fix the Cursor orientation bug number #388.

@alexfalconflores
Copy link

The styling of this control in UWP does not look the same as the styling of WASM or the toolkitlabs.dev page.
In the UWP version it shows an old design.

Screenshot 2023-06-28 194942

UWP (xmlns:labs="using:CommunityToolkit.Labs.WinUI" )

Screenshot 2023-06-28 194959

toolkitlabs.dev

@michael-hawker
Copy link
Member Author

@alexfalconflores
Copy link

alexfalconflores commented Jul 1, 2023

@niels9001
Copy link
Collaborator

Screenshot 2023-07-01 171827
I'm using this

https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-MainLatest/nuget/v3/index.json

@alexfalconflores Looks like you are using the Sizers from Labs.. we have recently moved these to the main Toolkit and made any updates there.

So, instead of using CommunityToolkit.Labs.Uwp.Sizers use the CommunityToolkit.Uwp.Sizers package.. it's on the same preview Nuget feed!

@alexfalconflores
Copy link

alexfalconflores commented Jul 4, 2023

Thanks for the help @niels9001 and @michael-hawker. The new control design looks great. Keep it up.

Do you know when UWP will support .net 7 or 8?

CommunityToolkit.Uwp.Controls.Sizers . nuget prerelease

Screenshot 2023-07-04 125946
Screenshot 2023-07-04 130047

@michael-hawker
Copy link
Member Author

Do you know when UWP will support .net 7 or 8?

@alexfalconflores see discussions here and here - if you need the latest .NET then you'd want to port to WinUI 3 (which is what we're making all our components work with both to make it easy to do). If you just need newer language features for C#, look at PolySharp.

@michael-hawker
Copy link
Member Author

This was shipped in the 8.0 Release, please update to use that version of the component. Any further issues/requests should start in the main repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement to an existing feature experiment 🧪 Used to track issues that are experiments (or their linked discussions) partner ⏹ Label for issues that are being depended on by Toolkit partners.
Projects
Status: Done
Status: Done
4 participants