开发者

Windows Phone simple data binding issue

Here is my XAML code:

<TextBlock x:Name="subTitle" Text="{Binding Name}" />

And my C# code:

PropertyInfo pi = ...;
subTitle.DataContext = pi;

The TextBlock displays simply nothing.

There is no DataContextChanged event but the TextBlock gets not开发者_如何学Cified about the change because if I omit the path "Name" from the binding expression I get the ToString() representation of the DataContext. I can access no property of the bound object. There are no tools for debugging and I spent hours on this tiny but breaking issue.

Please help me solve this problem. Is it a bug or am I missing something? Thank you very much.


I'd guess that PropertyInfo.Name isn't a dependency property and/or it doesn't implement INotifyPropertyChanged.

Create your own viewmodel object (which implements INotifyPropertyChanged) and use that for binding values to the view.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜