I’ve got a generic base page class that I’d like to use with my Silverlight pages. The only problem is that the x:TypeArguments attribute doesn’t seem to be working.
The attribute is only applied to the root element of the XAML page, and nowhere else.
The error message I keep getting from the compiler is: "Using the generic type 'Base.BasePage<T>' requires 1 type arguments". This error is always pointing to the generated Page.g.i.cs file.
Here is an example of what my root element looks like:
<Base:BasePage x:TypeArguments="ViewModels:MyViewModel">
I’ve had trouble finding good information on whether this is supported in Silverlight 4. Any help would be greatly appreciated. Thanks!
Unfortunately it isn’t yet supported in Silverlight. If you want to include a class in XAML it can’t be generic. You could still have a generic and add it to the Visual Tree from code, but not directly in the XAML.