Hi
When setting a string value to Wisej Open FileDialog “Filter” property, it does not get reflected in the FileDialog when it is launched.
var webOpenFileDialog = new OpenFileDialog
{
Multiselect = true,
Title = “Select Files”,
CheckFileExists = false
};
webOpenFileDialog.Filter = files; // files is a ; separated string values that were generated from a list.
I can see the value being set to Filter while debugging the code, but it does not reflect in the OpenFileDialog.
Thanks
praveena
I figured out the issue why the filter was not getting applied. So in the filter property -$”Files ({files})| {files}”, the space after the vertical bar was causing the issue.
Removing the space helped in showing the filtered files.
thanks
praveena
Filter is not a list of files. It’s the list of file types. See https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.filedialog.filter?view=net-5.0.
If there is still an issue please send a test case.
Hi Luca
Thanks for the reply. By files I meant its a string value with different filetypes that are semicolon separated.
So for instance
files = “*.jpeg;*.jpg; //this is generated from a list of filetype values selected by the user.
and if I use this for applying the filter like
webOpenFileDialog.Filter = $”Files ({files})| {files}”;
I can see the dialog displays the value in the dialog as shown in the attached image.
But when i select a folder to select files, it does not display any files at all. Neither it shows based on the filter nor it displays all the files.
thanks
praveena
Please login first to submit.