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. Shadow effect for selected tab in code behind. #6550

Open
1 of 2 tasks
valvasiliev opened this issue Jan 5, 2022 · 4 comments
Open
1 of 2 tasks

TabView. Shadow effect for selected tab in code behind. #6550

valvasiliev opened this issue Jan 5, 2022 · 4 comments
Labels
bug Something isn't working product-winui3 WinUI 3 issues team-Controls Issue for the Controls team

Comments

@valvasiliev
Copy link

valvasiliev commented Jan 5, 2022

Describe the bug

I tried to create transparent tab style with TextBlock and Underline only. But, control always add shadow effect for selected tab. Looks like it is impossible to implement this style.

Steps to reproduce the bug

1)Try to create transparent tab.
2) You see Shadow and CornerRadius for selected tab.

Expected behavior

You able create transparent tab without any shadows and CornerRadius

Screenshots

Shadow

NuGet package version

WinUI 3 - Windows App SDK 1.0 (If you're seeing your issue in older previews of WinUI 3, please try this release)

Windows app type

  • UWP
  • Win32

Device form factor

Desktop

Windows version

May 2021 Update (19043)

Additional context

Why you always add shadow effect in code behind? (looks like the same problem with corner radius for selected tab)

if (tabView)
    {
        if (SharedHelpers::IsThemeShadowAvailable())
        {
            if (internalTabView)
            {
                winrt::ThemeShadow shadow;
                if (!SharedHelpers::Is21H1OrHigher())
                {
                    if (auto shadowReceiver = internalTabView->GetShadowReceiver())
                    {
                        shadow.Receivers().Append(shadowReceiver);
                    }
                }
                m_shadow = shadow;

                double shadowDepth = unbox_value<double>(SharedHelpers::FindInApplicationResources(c_tabViewShadowDepthName, box_value(c_tabShadowDepth)));

                const auto currentTranslation = Translation();
                const auto translation = winrt::float3{ currentTranslation.x, currentTranslation.y, (float)shadowDepth };
                Translation(translation);

                UpdateShadow();
            }
        }
        m_tabDragStartingRevoker = tabView.TabDragStarting(winrt::auto_revoke, { this, &TabViewItem::OnTabDragStarting });
        m_tabDragCompletedRevoker = tabView.TabDragCompleted(winrt::auto_revoke, { this, &TabViewItem::OnTabDragCompleted });
    }


void TabViewItem::UpdateShadow()
{
    
    if (SharedHelpers::IsThemeShadowAvailable() && !XamlControlsResources::IsUsingControlsResourcesVersion2())
    {
        if (IsSelected() && !m_isDragging )
        {
            Shadow(m_shadow.as<winrt::ThemeShadow>());
        }
        else
        {
            Shadow(nullptr);
        }
    }
}
@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label Jan 5, 2022
@zadjii-msft
Copy link
Member

This also looks like #6076

@gabbybilka gabbybilka added the product-winui3 WinUI 3 issues label Feb 8, 2022
@StephenLPeters
Copy link
Contributor

There has been some work done on tabview in Winui2 and I think this issue will be resolved when we port that work to winui3 next.

@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 Mar 2, 2022
@github-actions
Copy link

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@zadjii-msft
Copy link
Member

Actually, in retrospect, this is different from #6076. It's a bit like what we discussed in microsoft/terminal#7213 (comment). Because the TabViewItem sets this stuff in codebehind, it's literally impossible to remove certain styling.

(see also #7032)

@duncanmacmichael duncanmacmichael added bug Something isn't working and removed area-TabView labels Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working product-winui3 WinUI 3 issues team-Controls Issue for the Controls team
Projects
None yet
Development

No branches or pull requests

5 participants