This is a broad question to answer in one post. I will provide a couple of things to think and explore.
(Note: all of the code in this post is a free hand from memory. It may not be 100% syntactically correct.)
, , MVVM. MVVM MVC , View to View Model (Controller). , .
, WP 7, WP 8, WP8.1, Siverlight Universal App. WPF, MVVM , , .
.
1) "Views" "ViewModels". , .
2) TextBlock. xaml . "" "MyFirstPage". :
<TextBlock Text="The Title of my App" />
3) , .
4) ViewModel. . ViewModels MyFirstViewModel.
5) () ViewModel. , , . DataContext - . , , , . , , .
public class MyFirstPage : Page
{
private MyFirstViewModel _viewModel = new MyFirstViewModel();
public MyFirstPage()
{
this.Initialize???
this.DataContext = _viewModel;
}
6) Title .
public string Title { get { return "The Title of my App (set from View Model)"; } }
7) TextBlock
<TextBlock Text="{Binding Title}" />
8) , , .
, .
, :
. , TextBox, , {Binding FirstName, Mode = TwoWay} , .
. , , , . , , , . . , . , , FirstName, INotifyPropertyChanged ViewModel OnPropertyChanged ( "FirstName" ). , .
ObservableCollections. , , , , . - ObservableCollection. , . , , getter . , getter . - ObservableCollection, , OnPropertyChanged , , ObservableCollection, . , , . .
. , , . BooleanToVisibilityConverter. . , .
. , , . relay click. , , , ViewModel, , , Button RelayCommand .
, .
, , , .
:
ViewModel , - ( ). , , . , , Lib ViewModels . Windows Phone 8.1 Project, Windows 8.1 (Store) Lib. ViewModels Lib , . , , , Inversion of Control, .
,
Tom