Reputation: 785
Is it possible to instantiate generic types in XAML for Windows Store App?
For example, I have page base class:
public class PageBase<T> : Page
{
}
How to create page of type PageBase<string>
in XAML?
Upvotes: 1
Views: 578
Reputation: 2327
No, it's not possible out of the box.
You can try a workaround (for example here), but from personal experience, I wouldn't recommend it, things get messy really fast. We've tried to implement the above solution, but it turned out that it is easier to revise the design than handling generics from XAML.
In your case, I would recommend created derived classes from your base page using a specific type.
Upvotes: 1