-
Notifications
You must be signed in to change notification settings - Fork 1.9k
WinUI: TabbedPage pages provided by a DataTemplate crash when swapping to a different tab. #14572
Copy link
Copy link
Open
Labels
area-controls-tabbedpageTabbedPageTabbedPagearea-layoutStackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenterStackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenterpartner/syncfusionIssues / PR's with Syncfusion collaborationIssues / PR's with Syncfusion collaborationplatform/windowss/triagedIssue has been reviewedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering TriageVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't workingSomething isn't working
Milestone
Description
Description
When a TabbedPage is used as the root application page and the child pages are provided using ItemsSource, the app crashes when a tab other than the current tab is pressed.

Steps to Reproduce
- Create a new MAUI app.
- Replace App.xaml.cs with this:
public partial class App : Application
{
public App()
{
InitializeComponent();
var rootPage = new TabbedPage();
rootPage.ItemsSource = new List<object> { new Vm1(), new Vm2(), new Vm3() };
rootPage.ItemTemplate = new TabbedItemTemplateSelector();
MainPage = rootPage;
}
public class Vm1 { }
public class Vm2 { }
public class Vm3 { }
class TabbedItemTemplateSelector : DataTemplateSelector
{
protected override DataTemplate OnSelectTemplate(object item, BindableObject container)
{
if (item is Vm1)
return new DataTemplate(() => new ContentPage() { Title = "Type 1" });
if (item is Vm2)
return new DataTemplate(() => new ContentPage() { Title = "Type 2" });
if (item is Vm3)
return new DataTemplate(() => new ContentPage() { Title = "Type 3" });
return null;
}
}
}- Run in on Windows and tap for a crash.
Link to public reproduction project repository
https://github.com/Keflon/TabbedPageTemplateBug
Version with bug
7.0 (current)
Last version that worked well
Unknown/Other
Affected platforms
Windows
Affected platform versions
Latest
Did you find any workaround?
No. If anyone finds one please share here.
Relevant log output
Exception thrown: 'System.ArgumentException' in WinRT.Runtime.dll
WinRT information: The parameter is incorrect.Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-controls-tabbedpageTabbedPageTabbedPagearea-layoutStackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenterStackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenterpartner/syncfusionIssues / PR's with Syncfusion collaborationIssues / PR's with Syncfusion collaborationplatform/windowss/triagedIssue has been reviewedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering TriageVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't workingSomething isn't working