编辑 :
我已经修复了代码包的来源并上传了更新的 NuGet 包:
https://www.nuget.org/packages/WindowsAPICodePack-Shell/
感谢dmex的错误修复: http: //archive.msdn.microsoft.com/WindowsAPICodePack/WorkItem/View.aspx? WorkItemId=108
如您所见,问题已解决,无需使用繁琐的Opened
事件语法:
指定图标时,对话框高度不正确;最后一个命令链接不完全可见:
你知道如何解决这个问题吗?
用于显示此对话框的代码:
var dialog = new TaskDialog
{
Caption = Title,
InstructionText = "Some files added are already in the collection.",
Text = "They have been skipped."
};
dialog.Opened += (s1, e1) => { dialog.Icon = TaskDialogStandardIcon.Warning; };
var linkContinue = new TaskDialogCommandLink("Continue", "Continue", string.Empty);
linkContinue.Click += (s2, e2) =>
{
var s = (TaskDialogCommandLink)s2;
var taskDialog = (TaskDialog)(s.HostingDialog);
taskDialog.Close();
};
dialog.Controls.Add(linkContinue);
var linkView = new TaskDialogCommandLink("View", "View these files", string.Empty);
linkView.Click += (s3, e3) =>
{
var s = (TaskDialogCommandLink)s3;
var taskDialog = (TaskDialog)(s.HostingDialog);
taskDialog.Close();
var window1 = new Window1 { Text = files, Title = Title };
window1.ShowDialog();
};
dialog.Controls.Add(linkView);
dialog.Show();