开发者

Silverlight/Windows Phone - EventToCommand DataContext Weirdness

I'm currently using MVVMLight for my WP7 app and have found that the datacontext for an EventToCommand is always the page datacontext. I'm also using the phon开发者_C百科e.codeplex.com panorama control and had set the datacontext for each PanoramaItem to a different ViewModel but this datacontext is ignored and the page data context is used instead.

Anyone know why?


This should not be the case. After working intensively for 2 weeks on a WP7 application with MVVM light, i can confirm that the DataContext should be set correctly. It is possible that

a) the CodePlex panorama control does something weird. That would be surprising but I cannot exclude it, having never used this control.

b) your DataContext has been overwritten somewhere in your DataTemplate. Blend does that sometimes. Make sure that this is not the case.

If the problem persists, send me a repro (small extract of the code where the problem is visible) and I will check it out.

Thanks, Laurent

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜