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.CloseButtonOverlayMode not set on new tabs #9180

Open
Mangepange opened this issue Dec 20, 2023 · 3 comments
Open

TabView.CloseButtonOverlayMode not set on new tabs #9180

Mangepange opened this issue Dec 20, 2023 · 3 comments
Labels
area-TabView bug Something isn't working team-Controls Issue for the Controls team

Comments

@Mangepange
Copy link

Describe the bug

The value of TabView.CloseButtonOverlayMode is not reflected on new tabs added in runtime. New tabs always have their close button visible.

Steps to reproduce the bug

Using the template studio for WinUI, i updated MainPage.xaml and MainViewModel with the code below.
Tabs added with the "Add"-button show their close buttons.
Switching CloseButtonOverlayMode in runtime (which btw does not seem to respond to binding) seems to effect the existing tabs, but when adding more tabs they always show the close button.

MainViewModel:

using System.Collections.ObjectModel;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;

namespace App2.ViewModels;
public partial class MainViewModel : ObservableRecipient
{
    [ObservableProperty]
    private ObservableCollection<string> _tabs = new();

    private int _counter = 0;

    [RelayCommand]
    private void Add()
    {
        Tabs.Add($"Content {_counter++}");
    }
}

MainPage.xaml:

<Page
    x:Class="App2.Views.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">
    <StackPanel>
        <Button Command="{x:Bind ViewModel.AddCommand}" Content="Add"/>
        <TabView TabItemsSource="{x:Bind ViewModel.Tabs}"
                 CloseButtonOverlayMode="OnPointerOver"/>
    </StackPanel>
</Page>

Expected behavior

Added TabItems in a TabView should respect the CloseButtonOverlayMode property.

Screenshots

image

NuGet package version

WinUI 3 - Windows App SDK 1.4.3: 1.4.231115000

Windows version

No response

Additional context

No response

@Mangepange Mangepange added the bug Something isn't working label Dec 20, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Dec 20, 2023
Copy link

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@bpulliam bpulliam added area-TabView team-Controls Issue for the Controls team and removed needs-triage Issue needs to be triaged by the area owners labels Jan 5, 2024
@twinstar6980
Copy link

Observed the same issue on WinAppSDK 1.5.
I need to assign a value to CloseButtonOverlayMode every time I add an item to TabView.
It seems that this problem has existed for at least two years, but MS has not fixed it.

@Mangepange
Copy link
Author

Yeah, I fixed it with a Behavior that sets CloseButtonOverlayMode every time TabItemsChanged is triggered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-TabView bug Something isn't working team-Controls Issue for the Controls team
Projects
None yet
Development

No branches or pull requests

3 participants