you can restrict the action by defining its Action-Property in the constructor
private void OpenOFD()
{
Gtk.FileChooserDialog filechooser =
new Gtk.FileChooserDialog("Choose the file to open",
this,
FileChooserAction.Open,
"Cancel",ResponseType.Cancel,
"Open",ResponseType.Accept);
if (filechooser.Run() == (int)ResponseType.Accept)
{
System.IO.FileStream file = System.IO.File.OpenRead(filechooser.Filename);
file.Close();
}
filechooser.Destroy();
}
There are 4 FolderChooserActions:
- CreateFolder: Indicates a mode for creating a new folder. The chooser will let the user name an existing or new folder
- Open: Will only pick an existing file
- Save: Will pick an existing file or type in a new filename
- SelectFolder: Pick an existring folder