开发者

MVVM Light DialogMessage

开发者 https://www.devze.com 2023-02-04 07:38 出处:网络
im trying to use the mvvmlight DialogMessage. var message = new DialogMessage( \"Confirm Delete\", RemoveAddressAction)

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 sourc开发者_运维技巧e 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.


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.


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..?;

0

精彩评论

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