mercredi 1 octobre 2014

Binding View to ContentPresenter MVVM


Vote count:

0




i try to show my View in a ContentPresenter. Its the first time i am doing this so here is what i got so far.


I got a ViewModel that represents the DataContext of my "MainView" its the DocumentView. In the DocumentViewModel i got the following Attribute.



public DocumentAnnotationViewModel Annotation
{
get
{
return this.DocumentAnnotation;
}
set
{
if (this.DocumentAnnotation != value)
{
this.DocumentAnnotation = value;
this.OnPropertyChanged("Annotation");
}
}
}


All right and here is my Initialisation in the Page.Ressource in XAML of my DocumentAnnotationView.



<local:DocumentAnnotationView x:Key="AnnotationView"
DataContext="{Binding Path=Annotation, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
/>


If I try now to stuff it in here,


i get a Windows.UI.Xaml.Markup.XamlParseException


WinRT-Informationen: Failed to assign to property 'Windows.UI.Xaml.Controls.ContentPresenter.Content'. [Line: 105 Position: 31]



asked 58 secs ago







Binding View to ContentPresenter MVVM

Aucun commentaire:

Enregistrer un commentaire