System.InvalidOperationException when add tabitem to tabcontrol
Jhinxs opened this issue · 1 comments
Jhinxs commented
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).
my tabitem style:
To Reproduce
1
Expected behavior
1
Avalonia version
11.2.2.
OS
Windows
Additional context
No response
Jhinxs commented
and i try again, if add use FluentTheme will trigger exception