Binding DataContext [SOLVED]

Please report bugs here. If you are unsure whether something is a bug or an expected behavior, please post it on the "Technical Support" forum instead, and wait for a moderator to handle/move the post.
dunner
Posts: 4
Joined: Tue Nov 25, 2014 5:32 pm

Binding DataContext [SOLVED]

Postby dunner » Tue Nov 25, 2014 7:12 pm

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.

dunner
Posts: 4
Joined: Tue Nov 25, 2014 5:32 pm

Re: Binding DataContext

Postby dunner » Wed Nov 26, 2014 7:39 am

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

JS-Support
Site Admin
Posts: 813
Joined: Tue Apr 08, 2014 3:42 pm

Re: Binding DataContext

Postby JS-Support » Thu Dec 04, 2014 5:37 am

Thanks a lot for the bug report. We are going to fix this issue asap.

Thanks also for providing the workaround.

JS-Support
Site Admin
Posts: 813
Joined: Tue Apr 08, 2014 3:42 pm

Re: Binding DataContext

Postby JS-Support » Tue Mar 31, 2015 4:16 am

The issue has been fixed in the Beta 3.

Thanks a lot for reporting it.


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 1 guest