forked from martijn00/MvvmCross-Forms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMvxContentPage.cs
37 lines (31 loc) · 893 Bytes
/
MvxContentPage.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using Xamarin.Forms;
using MvvmCross.Core.ViewModels;
using MvvmCross.Binding.BindingContext;
namespace MvvmCross.Forms.Presenter.Core
{
public class MvxContentPage : ContentPage, IMvxContentPage
{
public object DataContext
{
get { return BindingContext; }
set { BindingContext = value; }
}
public IMvxViewModel ViewModel
{
get { return DataContext as IMvxViewModel; }
set { DataContext = value; }
}
public MvxViewModelRequest Request { get; set; }
}
public class MvxContentPage<TViewModel>
: MvxContentPage
, IMvxContentPage<TViewModel> where TViewModel : class, IMvxViewModel
{
public new TViewModel ViewModel
{
get { return (TViewModel)base.ViewModel; }
set { base.ViewModel = value; }
}
}
}