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

TabViewItem: Make background of the selected tab all one path #6282

Merged
merged 2 commits into from
Nov 18, 2021

Conversation

teaP
Copy link
Contributor

@teaP teaP commented Nov 11, 2021

Instead of having the selected tab be composed of 3 parts (LeftRadiusRenderTriangle, TabContainer, RightRadiusRenderTriangle) which often do not abut properly in high DPI, I'm setting the tab background to be a single path (SelectedBackgroundPath), which is set from code and updated whenever the size of the TabViewItem updates. Fixes #5954.

@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label Nov 11, 2021
@ranjeshj ranjeshj added team-Controls Issue for the Controls team area-TabView and removed needs-triage Issue needs to be triaged by the area owners labels Nov 11, 2021
dev/TabView/TabView.idl Outdated Show resolved Hide resolved
dev/TabView/TabView.idl Outdated Show resolved Hide resolved
auto const leftCorner = popupRadius.TopLeft;
auto const rightCorner = popupRadius.TopRight;

// Assumes 4px curving-out corners, which are hardcoded in the markup
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these really hardcoded? Couldn't the 4px be customized in XAML markup?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's the width/height of the LeftRadiusRenderArc and RightRadiusRenderArc, which I guess I could measure... the string is getting very unreadable/undebuggable, though. Is there a better way to construct this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's leave it as is for now, and if a request for customizability comes up, we can investigate at that point.

StringCchPrintf(strOut, ARRAYSIZE(strOut), data,
height - 1,
leftCorner, leftCorner, leftCorner, leftCorner, leftCorner,
ActualWidth() - (leftCorner + rightCorner),
Copy link
Contributor

Choose a reason for hiding this comment

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

What if ActualWidth is real small, like smaller than 8? Any issues there?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It won't look right, that's for sure. The MinWidth of a TabViewItem is set to 100, though; it could be changed but I wouldn't expect tabs that small.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK - MinWidth is not likely to be 8 or smaller.

@teaP
Copy link
Contributor Author

teaP commented Nov 18, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

auto const leftCorner = popupRadius.TopLeft;
auto const rightCorner = popupRadius.TopRight;

// Assumes 4px curving-out corners, which are hardcoded in the markup
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's leave it as is for now, and if a request for customizability comes up, we can investigate at that point.

StringCchPrintf(strOut, ARRAYSIZE(strOut), data,
height - 1,
leftCorner, leftCorner, leftCorner, leftCorner, leftCorner,
ActualWidth() - (leftCorner + rightCorner),
Copy link
Contributor

Choose a reason for hiding this comment

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

OK - MinWidth is not likely to be 8 or smaller.

@teaP teaP merged commit 92fbfcd into main Nov 18, 2021
@teaP teaP deleted the user/teaP/TabViewBackground branch November 18, 2021 19:27
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.

[Fix proposed] TabView bottom border line is too short
3 participants