编辑:
我修复了Code Pack的源代码并上传了更新的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();
答案 0 :(得分: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
};