1+ using System ;
2+ using System . Collections . Generic ;
3+ using System . IO ;
4+ using System . Linq ;
5+ using System . Runtime . InteropServices . WindowsRuntime ;
6+ using MobileSample_WinRT . ViewModels ;
7+ using ReactiveUI ;
8+ using Windows . Foundation ;
9+ using Windows . Foundation . Collections ;
10+ using Windows . UI . Xaml ;
11+ using Windows . UI . Xaml . Controls ;
12+ using Windows . UI . Xaml . Controls . Primitives ;
13+ using Windows . UI . Xaml . Data ;
14+ using Windows . UI . Xaml . Input ;
15+ using Windows . UI . Xaml . Media ;
16+ using Windows . UI . Xaml . Navigation ;
17+
18+ // The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236
19+
20+ namespace MobileSample_WinRT . Views
21+ {
22+ public sealed partial class StringTileView : UserControl , IViewFor < StringTileViewModel >
23+ {
24+ public StringTileView ( )
25+ {
26+ this . InitializeComponent ( ) ;
27+
28+ this . WhenActivated ( d => {
29+ d ( this . OneWayBind ( ViewModel , x => x . Model , x => x . Model . Text ) ) ;
30+ } ) ;
31+ }
32+
33+ public StringTileViewModel ViewModel {
34+ get { return ( StringTileViewModel ) GetValue ( ViewModelProperty ) ; }
35+ set { SetValue ( ViewModelProperty , value ) ; }
36+ }
37+ public static readonly DependencyProperty ViewModelProperty =
38+ DependencyProperty . Register ( "ViewModel" , typeof ( StringTileViewModel ) , typeof ( StringTileView ) , new PropertyMetadata ( null ) ) ;
39+
40+ object IViewFor . ViewModel {
41+ get { return ViewModel ; }
42+ set { ViewModel = ( StringTileViewModel ) value ; }
43+ }
44+ }
45+ }
0 commit comments