Question

EDIT :

I have fixed the sources of the Code Pack and uploaded an updated NuGet package :

https://www.nuget.org/packages/WindowsAPICodePack-Shell/

Thanks to dmex for the bug fix : http://archive.msdn.microsoft.com/WindowsAPICodePack/WorkItem/View.aspx?WorkItemId=108

As you can see, problem is fixed and no need to use the cumbersome syntax of Opened event:

enter image description here


When specifying an icon, the dialog height is incorrect; last command link isn't entirely visible :

enter image description here

Do you have an idea on how to fix this issue ?

Code used for showing this dialog :

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();
Was it helpful?

Solution

Try assigning "InstructionText" in .Opend even once again (seems to fix the problem in 1.1.0.0 as well).

        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
        };
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top