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

System.InvalidOperationException when add tabitem to tabcontrol #17677

Open
Jhinxs opened this issue Dec 3, 2024 · 1 comment
Open

System.InvalidOperationException when add tabitem to tabcontrol #17677

Jhinxs opened this issue Dec 3, 2024 · 1 comment
Labels

Comments

@Jhinxs
Copy link

Jhinxs commented Dec 3, 2024

Describe the bug

if i enable this in App.axaml:

    <FluentTheme DensityStyle="Compact">
        <FluentTheme.Palettes>
            <ColorPaletteResources x:Key="Light" Accent="#BCD2EE" />
        </FluentTheme.Palettes>
    </FluentTheme>

then add tabitem to tabcontrol like this:

public MainWindow()
{
    InitializeComponent();
    EventLogTab myEventLogTab = new EventLogTab();
    this.mytabcontrol.Items.Add(myEventLogTab);
   
}

will throw an exception like this :

System.InvalidOperationException: The control Grid already has a visual parent ContentPresenter (Name = PART_SelectedContentHost, Host = TabControl (Name = RBRMainTab)) while trying to add it as a child of ContentPresenter (Name = PART_ContentPresenter, Host = AvaloniaApplication.EventLogTab).

image

my tabitem style:

image

To Reproduce

1

Expected behavior

1

Avalonia version

11.2.2.

OS

Windows

Additional context

No response

@Jhinxs Jhinxs added the bug label Dec 3, 2024
@Jhinxs
Copy link
Author

Jhinxs commented Dec 3, 2024

and i try again, if add use FluentTheme will trigger exception

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant