3

编辑 :

我已经修复了代码包的来源并上传了更新的 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();
4

1 回答 1

5

尝试在 .Opend 中再次分配“InstructionText”(似乎也解决了 1.1.0.0 中的问题)。

        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;
            dialog.InstructionText = dialog.InstructionText; // < seems to work
        };
于 2014-01-19T14:34:45.233 回答