-
Notifications
You must be signed in to change notification settings - Fork 703
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
Setting TabViewItem resources manually regressed in 2.8.x? #8260
Comments
A thought - maybe by defining my own style in my own resources, I broke the thing that enabled us to hot-swap the resource values like that. I'm gonna test to see if manually copying the 2.7 TabView style into our project and setting it as a custom style still works. That might help narrow the problem space. |
After some testing - nah, that wasn't it. On 2.7, putting a copy of the 2.7 tab view styles into our project still works exactly as expected. I'll see if I can build some hybrid 2.7 styles + 2.8 code chimera and see if that even compiles. update: The chimera (2.8 MUX with the 2.7 styles) builds and runs, but the tab colors are definitely still broken. So that makes me think it's not something that changed in |
@karenbtlai Could it be: microsoft-ui-xaml/dev/TabView/TabViewItem.cpp Lines 127 to 153 in 8390ab4
I have no idea what setting the Though, that seems like it's only used in the 2.8 xaml, so theoretically, by not having the |
Hey @zadjii-msft sorry for the late response. In this specific commit the colouring for TabViewItemBackground selected is updated such that Due to this, you will have to set
|
For future readers: We're closing this as resolved, despite not really knowing what happened here. You can see our PR to update the Terminal here: microsoft/terminal#15078. tl;dr: In >=MUX 2.7, we were updating our tab colors by doing a "Visual State Dance", as I called it. We'd manually change the So instead, we do a "Theme Dance", like so: const auto& reqTheme = TabViewItem().RequestedTheme();
TabViewItem().RequestedTheme(ElementTheme::Light);
TabViewItem().RequestedTheme(ElementTheme::Dark);
TabViewItem().RequestedTheme(reqTheme); This causes the We never got to the root cause of why this seems different in 2.8. It literally makes no sense. |
Filing this as a part of investigating updating the Terminal from v2.7.3-prerelease.220816001 to WinUI v2.8.2-prerelease.220830001. I'm on 25310.rs_we at the moment, though I noticed similar behavior the last time I tried to update to 2.8 last August. My original PR and notes are in microsoft/terminal#13657
The Terminal colorizes its tabs by updating the brushes in the Resources for individual tab items...
https://github.com/microsoft/terminal/blob/fe2220e07b3b46482a34f29cc2dabea9286fd02c/src/cascadia/TerminalApp/TabBase.cpp#L465-L468
... then makes a pair of
GoToState
calls to actually update the tab's visuals.https://github.com/microsoft/terminal/blob/fe2220e07b3b46482a34f29cc2dabea9286fd02c/src/cascadia/TerminalApp/TabBase.cpp#L552-L564
In my branch where I'm trying to update to 2.8, this seemingly no longer works. The tab foregrounds always seem to be
#282828
, the deselected colors never seem to update.Furthermore, I tried taking
TabView_themeresources.xaml
and dropping it wholesale into a resource dictionary, renaming the tab style toMyTabViewStyle
and manually setting our own tabview's style to that one, so I could try and wholly retemplate it. I could not get it to work the same as before at all.Seemingly, the TabViewItem's VisualState's seemed like they would evaluate the
{ThemeResource TabViewItemHeaderBackgroundSelected}
when the tab was instantiated (before we could set the resources on it). And it seemingly never re-evaluated those resources - you'd always get#282828
colored selected tabs, regardless of switching into/out of the selected state. Looking at the diff between 2.7 and 2.8, it looks like there was always aSetter
forTabContainer.Background
, so if my presumption is correct, then I have no idea how this ever worked.Can someone help me figure out what I did wrong here, or what changed in WinUI? This is a hard block from us adopting WinUI 2.8.
Notes
git log afa4a59f0d8d22bc2553492a49f6e017797869e1..0c556e89bf4d539c2fb3e5fe0a71e57a79fb3a1b --pretty=format:"%h %ad %s" --date=short -- dev/TabView/TabView.xaml
The text was updated successfully, but these errors were encountered: