uwp - Prism-Mvvm app deployment error on Mobile Emulator -
i got exception when deploying simple prism.mvvm app on mobile emulator 10586,while works on simulator on local machine. referencing prism.storeapps package.here code
app.xaml.cs
namespace mvvmsample { sealed partial class app : mvvmappbase { public app() { initializecomponent(); } public enum expirences { main } protected override task onlaunchapplicationasync(launchactivatedeventargs args) { this.navigationservice.navigate(expirences.main.tostring(), null); return task.fromresult<object>(null); } } }
mainpage.xaml
<controls:pagebase x:class="mvvmsample.views.mainpage" xmlns:controls="using:mvvmsample.controls" xmlns:prism="using:microsoft.practices.prism.mvvm" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:mvvmsample" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" prism:viewmodellocator.autowireviewmodel="true" mc:ignorable="d"> <d:page.datacontext> <local:mainpageviewmodel/> </d:page.datacontext> <grid background="{themeresource applicationpagebackgroundthemebrush}"> <textblock text="{binding title}" fontsize="29.333" /> </grid> </controls:pagebase>
view
namespace mvvmsample { namespace controls { public abstract partial class pagebase : page, iview { } } namespace views { public sealed partial class mainpage : controls.pagebase { public mainpage() { this.initializecomponent(); } } } namespace viewmodels { public class mainpageviewmodel : microsoft.practices.prism.mvvm.viewmodel { public string title { get; set; } public mainpageviewmodel() { this.title = "run time"; } } } }
you're using prism.storeapps, package windows 8.1. uwp should using prism.windows. reason why working on machine, because windows 10 can run windows 8 apps. while emulator specific sdk build.
for more info on available nuget packages windows 10 (including dependency injection), please check official github repo. there samples available in this repo.
Comments
Post a Comment