Search code examples
xamlabstracttemplate10

Template10 ModalDialog xaml error - Cannot create an abstract class


I have a UWP application based on the Template10 hamburger template. I added the following modal dialog.

<Controls:ModalDialog x:Name="LoginModal"
                          CanBackButtonDismiss="False"
                          DisableBackButtonWhenModal="True">
        <Controls:ModalDialog.ModalContent>
            <views:LoginView x:Name="loginPart"
                              HorizontalAlignment="Center"
                              VerticalAlignment="Center"
                              HideRequested="LoginHide"
                              LoggedIn="LoginLoggedIn" />
        </Controls:ModalDialog.ModalContent>
    </Controls:ModalDialog>

My login view is declared like this

[Export]
public sealed partial class LoginView : Page, IView 
{
    ....
}

For some reason the xaml extract above gives me a design time error saying "Cannot create an abstract class." The project builds and runs ok but the xaml designer won't work.

Anyone know what I'm doing wrong here?


Solution

  • LoginView would need to be a UserControl not a Page. The other properties would be added to that codebehind of that usercontrol to allow for interaction with the ModalDialog

    From the Samples folder... https://github.com/Windows-XAML/Template10/blob/master/Samples/Search/Controls/LoginPart.xaml.cs

    if this doesn't work then I would suspect the MEF [Export]