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

Proposal: Add TabDisplayMode for TabView #7202

Open
kingcean opened this issue Jun 7, 2022 · 1 comment
Open

Proposal: Add TabDisplayMode for TabView #7202

kingcean opened this issue Jun 7, 2022 · 1 comment
Labels
area-TabView feature proposal New feature proposal team-Controls Issue for the Controls team

Comments

@kingcean
Copy link

kingcean commented Jun 7, 2022

Summary

When we implement a browser with tabs, we may need to hide the tabs on full screen. So please add a property TabDisplayMode for TabView class to allow to do so. Its type is an Enum with following values.

  • Default: The tabs bar and the content are shown top-bottom.
  • Overlay: The tabs bar covers the content and does not take up space in the control layout.
  • Hidden: The tabs bar is hidden. Only shows the content.

Rationale

  • It allows developers to control if the tab is visible. It will be useful to hide when the content of the current tab selected should cover the screen more (just like in full-screen or other focus mode).
  • It allows developers to have opportunities to slide in the tabs when the tab was set invisibility, such as when the pointer is on the edge or somewhere.

Important Notes

Following is the Enum definition for example mentioned above.

public enum TabDisplayMode : byte
{
    Default = 0,
    Overlay = 1,
    Hidden = 2,
}

And add the property to TabView.

[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.UI.Xaml.Markup.ContentProperty(Name="TabItems")]
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.UI.Xaml.XamlContract), 65536)]
public class TabView : Control
{
+    public TabDisplayMode TabDisplayMode { get; set; }
}

Following is the usage example.

<Grid>
    <Border x:Name="TopElement"
        Height="1"
        VerticalAlignment="Top"
        PointerEntered="TopElement_PointerEntered"
        PointerExited="TopElement_PointerExited"  />
    <TabView x:Name="TabViewElement" >
        <!-- Some tabs -->
    </TabView>
</Grid>
private void TopElement_PointerEntered(object sender, PointerRoutedEventArgs e)
    => TabViewElement.TabDisplayMode = TabDisplayMode.Overlay;

private void TopElement_PointerExited(object sender, PointerRoutedEventArgs e)
    => TabViewElement.TabDisplayMode = TabDisplayMode..Hidden;

Open Questions

It would be great if WinUI team could also add vertical tabs.

@kingcean kingcean added the feature proposal New feature proposal label Jun 7, 2022
@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label Jun 7, 2022
@ojhad ojhad added area-TabView team-Controls Issue for the Controls team and removed needs-triage Issue needs to be triaged by the area owners labels Jun 10, 2022
@kingcean
Copy link
Author

Is there any plan to add such feature? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-TabView feature proposal New feature proposal team-Controls Issue for the Controls team
Projects
None yet
Development

No branches or pull requests

2 participants