Page 1 of 1

Binding DataContext [SOLVED]

Posted: Tue Nov 25, 2014 7:12 pm
by dunner
Is the full DataContext concept implemented, I am attempting to create a test app that displays the DateTime but using the MVVM design pattern. But the string is never displayed on the screen.

I created a class called ViewModel, it has a public property called DateAndTime. I am initializing the property on the constructor of this class. For simplicity, I am not inheriting from INotifyPropertyChanged yet. But I will.

Then in the MainPage.xaml.cs in the constructor after the InitializeComponent() call I create a new instance of ViewModel then assign it to this.DataContext. My Binding in XAML looks like this: <TextBlock Text="{Binding Path=DateAndTime}" x:Name="TextBlock1" />

I put a breakpoint on the public getter of my ViewModel.DateAndTime property, but it never gets hit.

Any ideas?

This concept works fine in "normal" full blown WPF.

Re: Binding DataContext

Posted: Wed Nov 26, 2014 7:39 am
by dunner
Resolved my issue. FYI

I changed my binding statement (which I know works in full WPF, but maybe not yet for CSHTML5...)

This didn't work
{Binding Path=PropertyName}

but this does
{Binding PropertyName

Hope this helps others

Re: Binding DataContext

Posted: Thu Dec 04, 2014 5:37 am
by JS-Support @Userware
Thanks a lot for the bug report. We are going to fix this issue asap.

Thanks also for providing the workaround.

Re: Binding DataContext

Posted: Tue Mar 31, 2015 4:16 am
by JS-Support @Userware
The issue has been fixed in the Beta 3.

Thanks a lot for reporting it.