MVVM 轻量对话消息
我正在尝试使用 mvvmlight DialogMessage。
var message = new DialogMessage(
"Confirm Delete", RemoveAddressAction)
{
Button = MessageBoxButton.OKCancel,
Caption = "Caption??"
};
VS2010 取消了“Button = MessageBoxButton.OKCancel”行,抱怨
“无法将源类型 'System.Windows.MessageBoxButton [PresentationFramework,Version=3.0.0.0,Culture...] 转换为目标类型 'System.Windows.MessageBoxItem [GalaSoft. MvvmLight,Version=3.0.0.29216,...]
当我尝试使用 DialogMessage 显示消息框时,视图后面的代码出现类似问题,
我以前不知道如何修复它。
谢谢。
im trying to use the mvvmlight DialogMessage.
var message = new DialogMessage(
"Confirm Delete", RemoveAddressAction)
{
Button = MessageBoxButton.OKCancel,
Caption = "Caption??"
};
VS2010 undelines the "Button = MessageBoxButton.OKCancel" line complaining about
"Cannot convert source type 'System.Windows.MessageBoxButton [PresentationFramework, Version=3.0.0.0, Culture...] to target type 'System.Windows.MessageBoxItem [GalaSoft.MvvmLight, Version=3.0.0.29216, ...]
And a similar issue on the code behind on the view when I try to use the DialogMessage to show the messagebox.
Has anyone encountered this before? I have no clue how to fix it.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我也有同样的问题。我删除了对 GalaSoft.MvvmLight 的引用,然后再次添加它们,然后重建解决了编译器错误。
清理和重建解决方案不起作用,直到删除并阅读参考文献。
I had the same problem. I removed the refrences to GalaSoft.MvvmLight, added them again, and rebuilding resolved the compiler errors.
Cleaning and rebuilding the solution did not work, until removed and readded the references.
我将你的代码复制粘贴到我的(VS2010)中,它构建时没有下划线。值得尝试的事情:
解决方案清理和构建;检查您是否有最新的 MVVM Light;
检查 Button 的类型并显式声明 System.Windows.MessageBoxButton 或 System.Windows.MessageBoxItem;目标.NET 4.0..?;
I copy-pasted your code in mine (VS2010) and it builds with no underline. Things to try:
Solution Clean and Build; Check if you have the latest of MVVM Light;
Check Button's type and explicitly state System.Windows.MessageBoxButton or System.Windows.MessageBoxItem; Target .NET 4.0..?;