Я пытаюсь реализовать папку «Обзор» в WF 4.5 Workflow Activity, но кнопка с эллипсами не отображается, и почти ничего не происходит.UITypeEditor в Windows Workflow Designer 4.5 (Просмотр папки)
Это мой UITypeEditor класс:
public class BrowseForFolderEditor : UITypeEditor
{
public override object EditValue(ITypeDescriptorContext context,
IServiceProvider provider, object value)
{
string folderName = string.Empty;
BrowseForFolderAttribute browseForFolderAttribute = null;
if (value is string)
{
if (context?.PropertyDescriptor != null)
{
browseForFolderAttribute =
(BrowseForFolderAttribute)
context.PropertyDescriptor.Attributes[typeof(BrowseForFolderAttribute)];
}
var browse = new FolderBrowserDialogEx
{
Description = browseForFolderAttribute?.Description,
ShowNewFolderButton = true,
ShowEditBox = true,
SelectedPath = folderName,
ShowFullPathInEditBox = false,
RootFolder = Environment.SpecialFolder.MyComputer
};
var result = browse.ShowDialog();
if (result == DialogResult.OK)
folderName = browse.SelectedPath;
return folderName;
}
// Return whatever value if it wasn't a string - Should never occur!
return value;
}
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
{
return UITypeEditorEditStyle.Modal; //base.GetEditStyle(context);
}
public class BrowseForFolderAttribute : Attribute
{
public BrowseForFolderAttribute(string description)
{
this.Description = description;
}
public string Description { get; set; }
}
}
И это, как я объявляю код в моем Activity
:
[Description("Select the folder where the files will be
copied/moved to.")]
[Category("Folders")]
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
[BrowseForFolderEditor.BrowseForFolder("Select the folder where the files will be
copied/moved to.")]
[Editor(typeof(BrowseForFolderEditor), typeof(UITypeEditor))]
public string TargetPath { get; set; }
Я не знаю, если это делает никакой разницы, но мой рабочий процесс Activity
имеет тип NativeActivity
.
Свойство отображается в сетке свойств, но оно просто отображается как текстовое поле без кнопки эллипса.
Любая помощь будет оценена по достоинству.
ДОПОЛНЕНО-1:
Проблема не имеет ничего общего с тем, что это NativeCodeActivity
как я только изменил мой код CodeActivity
и это не имело никакого значения.