-
Notifications
You must be signed in to change notification settings - Fork 698
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: Add theme resource to style the tab separator more easily #2674
TabView: Add theme resource to style the tab separator more easily #2674
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
As for your additional note I think you are right this seems wrong. However I don't think we should introduce a breaking change over this. Instead I think we should introduce a second resource (TabViewItemSeparatorForeground) that points to the original. Or possibly the other way around, the original points to the new. |
This is because the system starts looking for a resouce at the resource dictionary where the request is located. So in this case the tab view template is looking for TabViewItemSeparatorForeground and doesn't find it until is goes up the tree and eventually reaches the App.xaml where the controls library's theme resources get merged in. When resolving that resource we start a new search for TabViewItemSeparator but that search starts at App.xaml instead of at the tab view and thus we never see this override. So I think in order to get this to work you would need to have picked the other way around. This has the unfortunate side effect that the template has to have the poorly named resource though. |
@StephenLPeters Unfortunately, it seems the other way around doesn't work as well: <StaticResource x:Key="TabViewItemSeparator" ResourceKey="TabViewItemSeparatorForeground" />
<StaticResource x:Key="TabViewItemSeparatorForeground" ResourceKey="SystemControlForegroundBaseLowBrush" /> Now overriding Did I do something wrong here? I would have thought your explanation why I didn't work the other way around would also apply here...so perhaps I misunderstood you 🤔 |
There is usually a Brush and Color separation, is that needed here? |
Ah you are right, same problem this way.. I feel like there is a way to do this but I'm having trouble figuring it out. I don't think we should block this PR on this though, would you like to open a new issue on this? |
@StephenLPeters Opened a new issue to track this here: #2742 |
Description
This PR introduces a theme resource for the TabView's Separator margin to enable easier styling.
Motivation and Context
Closes #2344
How Has This Been Tested?
Tested visually
Additional Note
The theme resource to set the foreground color of the separator is currently named
TabViewItemSeparator
. To follow naming precedences with theme resources and to properly articulate which property of the separator this theme resource controls I propose to rename it toTabViewItemSeparatorForeground
. While this would be a breaking change I think it's worth it for the reasons state directly above. If approved, I could either do it in this PR or create a new one.