See Also: FileChooserDialog Members
Typical usage. In the simplest of cases, you can use the following code to select a file for opening:
C# Example
public class MainWindow: Gtk.Window {
protected virtual void OnBtnLoadFileClicked(object sender, System.EventArgs e)
{
Gtk.FileChooserDialog fc=
new Gtk.FileChooserDialog("Choose the file to open",
this,
FileChooserAction.Open,
"Cancel",ResponseType.Cancel,
"Open",ResponseType.Accept);
if (fc.Run() == (int)ResponseType.Accept)
{
System.IO.FileStream file=System.IO.File.OpenRead(fc.Filename);
file.Close();
}
//Don't forget to call Destroy() or the FileChooserDialog window won't get closed.
fc.Destroy();
}