Skip to content

Instantly share code, notes, and snippets.

@vmilev
Created February 29, 2016 13:19
Show Gist options
  • Save vmilev/d35728f46b57422c7524 to your computer and use it in GitHub Desktop.
Save vmilev/d35728f46b57422c7524 to your computer and use it in GitHub Desktop.
Share Code Blog 1
using MyApp.Infrastructure;
namespace MyApp.Views
{
public sealed partial class MainPage : PageBase
{
public MainPage()
{
this.InitializeComponent();
}
}
}
using MyApp.Infrastructure;
namespace MyApp.ViewModels
{
public class MainPageViewModel : ViewModelBase
{
private string title;
public string Title
{
get { return this.title; }
set { SetProperty(ref title, value); }
}
public MainPageViewModel()
{
this.Title = "Hello, MVVM World!";
}
}
}
using Microsoft.Practices.Prism.Mvvm;
namespace MyApp.Infrastructure
{
#if NETFX_CORE
public abstract partial class PageBase : Windows.UI.Xaml.Controls.Page, IView
#else
public abstract partial class PageBase : System.Windows.Controls.Page, IView
#endif
{
}
}
<infrastructure:PageBase
xmlns:infrastructure="using:MyApp.Infrastructure"
prism:ViewModelLocator.AutoWireViewModel="true"
xmlns:prism="using:Microsoft.Practices.Prism.Mvvm"
x:Class="MyApp.Views.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:MyApp.Views"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
....
</infrastructure:PageBase>
using Microsoft.Practices.Prism.Mvvm;
namespace MyApp.Infrastructure
{
#if NETFX_CORE
public abstract partial class ViewModelBase : ViewModel
#else
public abstract partial class ViewModelBase : BindableBase
#endif
{
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment