一直认为Telerik Silverlight radwindow控件的ShowDialog()方法会显示一个模式对话框(modal dialog) - 就像System.Windows.MessageBox.Show方法一样。但是,那不是一个真正的模式对话框:ShowDialog()方法不是同步等待窗口关闭后再返回,而是异步的,即执行后马上返回,继续执行后续代码。
来自Telerik 论坛的回复:
This is a limitation of Silverlight,since there is no way you can stop the execution thread and get synchronous results. This is one of the reason our radwindow doesn't work synchronously
(http://www.telerik.com/community/forums/silverlight/window/problem-with-threads-how-radwindow-show-works.aspx)
真正的模式对话框还是那个System.Windows.MessageBox.Show 可是界面不敢恭维。该方法调用了Silverlight的Core代码:
[DllImport("agcore",EntryPoint="MessageBox_ShowCore",CharSet=CharSet.Unicode)]
private static extern uint MessageBox_ShowCoreNative(IntPtr context,[MarshalAs(UnmanagedType.LPWStr)] string messageBoxText,[MarshalAs(UnmanagedType.LPWStr)] string caption,uint type,out int result);
然后Core又调用了OS的平台方法?因为msdn中有如下描述:
The message Box may have a slightly different appearance on different platforms. For example,the message Box includes an icon when it is displayed on a Macintosh.
http://msdn.microsoft.com/en-us/library/system.windows.messagebox(VS.95).aspx
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。