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

Tabview switch to converter instead of template settings #2827

Merged
merged 8 commits into from
Jul 15, 2020

Conversation

marcelwgn
Copy link
Collaborator

Description

Switched to unfortunately quite specific converters to remove template settings.

The naming of the new converter and its properties can definitely be changed!

Motivation and Context

Remove template settings to keep view and logic separated. See this thread for more context.

How Has This Been Tested?

Run app and verify visuals (TabView looks the same).

Screenshots (if appropriate):

@msft-github-bot msft-github-bot added the needs-triage Issue needs to be triaged by the area owners label Jul 4, 2020
[WUXC_VERSION_PREVIEW]
[webhosthidden]
[default_interface]
runtimeclass CornerRadiusToFilteredMultipliedThicknessConverter : Windows.UI.Xaml.DependencyObject, Windows.UI.Xaml.Data.IValueConverter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use CornerRadiusToThicknessConverter and add the Multiplier property?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately in it's current form, the CornerRadiusToThicknessConverter wouldn't help us with a multiplier property. The CornerRadiusToThicknessConverter always sets two directions to zero and the other two to the corner radius value.
Essentially it would move the item diagonally. In our case however, we would need to move the item the left/right which the CornerRadiusToThicknessConverter can't provide.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The existing CornerRadiusToThicknessConverter sets two components from the Thickness from the CornerRadius, and sets the rest to zero. The new converter needs to take one component from the CornerRadius and set the rest to zero. So couldn't we reuse it with a new CornerRadiusToThicknessConverterKind (plus the multipler)?

public enum CornerRadiusToThicknessConverterKind
{
FilterTopAndBottomFromLeft = 0,
FilterTopAndBottomFromRight = 1,
FilterLeftAndRightFromTop = 2,
FilterLeftAndRightFromBottom = 3,

// new
FilterLeftFromBottomLeft
FilterTopFromTopLeft
...

}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like you could expand the CornerRadiusToThicknessConverterKind to have more enum values like FilterTopFromTopLeft and then also add the multiplier property


In reply to: 450386895 [](ancestors = 450386895)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All right, I'll update the existing converter. So we would introduce 8 new values to the enum right?

LeftFromBottomLeft,
LeftFromTopLeft,
TopFromTopLeft,
TopFromTopRight,
and so on.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the existing converter.

break;
case winrt::CornerRadiusToThicknessSide::Top:
result.Left = 0;
result.Top = radius.TopLeft * multiplier;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

radius.TopLeft * multiplie [](start = 21, length = 26)

How did you decide that this should come from radius.TopLeft instead of radius.TopRight?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I "rotated" the corner radii by 45° clockwise. That way, bottomleft becomes left, topleft becomes top etc. The 45° clockwise were chosen arbitrarily.

Copy link
Contributor

@StephenLPeters StephenLPeters Jul 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we do something like, for result.Top, take the max of TopLeft and TopRight?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that this converter is removed now, should we add this behavior to the CornerRadiusToThicknessConverter? With the current state of the PR, developers would be able to choose whether the left thickness should come from TopLeft or BottomLeft of the corner radius.

@StephenLPeters
Copy link
Contributor

Please merge from master to pick up the GSL const enforcement change and rebuild to make sure you aren't missing something that will block on.

@marcelwgn
Copy link
Collaborator Author

Please merge from master to pick up the GSL const enforcement change and rebuild to make sure you aren't missing something that will block on.

Good point.

@StephenLPeters StephenLPeters added area-TabView team-Controls Issue for the Controls team and removed needs-triage Issue needs to be triaged by the area owners labels Jul 6, 2020
@MikeHillberg
Copy link
Contributor

Added an API spec: microsoft/microsoft-ui-xaml-specs#90

Copy link
Contributor

@StephenLPeters StephenLPeters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕐

Copy link
Contributor

@StephenLPeters StephenLPeters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@StephenLPeters
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@marcelwgn
Copy link
Collaborator Author

Looks like last test run failed due to heap limit. Merged with master to get latest fix for that.

@ranjeshj
Copy link
Contributor

ranjeshj commented Jul 8, 2020

Looks like last test run failed due to heap limit. Merged with master to get latest fix for that.

one more time :)

@marcelwgn
Copy link
Collaborator Author

I think my latest merge with master already has the newest fix.

@StephenLPeters
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ranjeshj ranjeshj requested a review from teaP July 13, 2020 20:36
@StephenLPeters
Copy link
Contributor

@teaP Feel free to merge this in if you don't find any changes needed

@teaP teaP merged commit 8aaf7f8 into microsoft:master Jul 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-TabView team-Controls Issue for the Controls team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants