WF 4.5ワークフローアクティビティでフォルダの参照を実装しようとしていますが、省略記号ボタンが表示されず、ほとんど何も起こりません。Windows Workflow Designer 4.5のUITypeEditor
これは私の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
です。
プロパティはプロパティグリッドに表示されますが、楕円のないテキストボックスとして表示されます。
ご協力いただければ幸いです。
UPDATE-1:
問題は、私はちょうどCodeActivity
に私のコードを変更しました、それは何の違いを作っていないとして、それがNativeCodeActivity
であるという事実とは何の関係もありません。