I'd like to know the same thing as this: Silverlight 4 Support for x:TypeArguments ... but for Windows 8 Store Apps.
Why is x:TypeArguments available if it doesnt work? Or am I missing something? The MainPage.i.g.cs file is auto-generated with a non-generic base class even though x:TypeArguments is defined in the XAML - so of course it doesn't compile.
I can get it working with the proposed work-around of having a "typedef" base class which specifies the generic type, but this feels pretty hacky to me..
// A generic PageBase, containing standard ViewModel-related utilities
internal abstract class PageBase<T> : Windows.UI.Xaml.Controls.Page where T : ViewModelBase
{
protected abstract T ViewModel { get; }
...
}
// The hack...
internal abstract class MainPageTypeDef : PageBase<MainViewModel>
{
// No code goes here...
}
// The page itself
internal sealed partial class MainPage : MainPageTypeDef
{
}
<views:PageBase
...
x:Class="Namespace.MainView"
x:TypeArguments="store:MainViewModel">
Anyone know if there is a way of not having the "typedef" class?
Many thanks, Jon