我使用以下代码打开面板,它应该让您能够只选择图像
openPanel = NSOpenPanel.OpenPanel;
openPanel.FloatingPanel = true;
openPanel.CanChooseFiles = true;
openPanel.AllowsMultipleSelection = true;
openPanel.CanChooseDirectories = false;
openPanel.AllowedFileTypes = new string [] { "png", "jpeg", "jpg", "gif" };
openPanel.BeginSheet (this.View.Window, (obj) => {
if (obj == 1 && openPanel.Urls != null) {}
当它打开时,我无法搜索文件夹....但如果我启用CanChooseDirectories
属性,如果也会搜索文件夹..
如何强制NSOpenPanel搜索文件夹,而不允许选择目录?