diff --git a/src/Eto/Forms/Controls/FilePicker.cs b/src/Eto/Forms/Controls/FilePicker.cs
index 5a9448550..102e26227 100644
--- a/src/Eto/Forms/Controls/FilePicker.cs
+++ b/src/Eto/Forms/Controls/FilePicker.cs
@@ -1,8 +1,22 @@
namespace Eto.Forms;
///
-/// Control for picking a file or folder.
+/// A control that allows the user to interact with files and folders.
+/// It can be used to save files, select files or select directories.
///
+///
+///
+/// var myFilePicker = new FilePicker
+/// {
+/// FileAction = FileAction.OpenFile
+/// }
+///
+/// var myFolderPicker = new FilePicker
+/// {
+/// FileAction = FileAction.SelectFolder
+/// }
+///
+///
[Handler(typeof(FilePicker.IHandler))]
public class FilePicker : Control
{
@@ -12,18 +26,15 @@ public class FilePicker : Control
static readonly object callback = new Callback();
- ///
- /// Gets an instance of an object used to perform callbacks to the widget from handler implementations.
- ///
- /// The callback instance to use for this widget.
+ ///
protected override object GetCallback() { return callback; }
///
- /// Gets or sets the index of the current filter in the collection
+ /// Gets or sets the index of the current filter in the collection.
///
///
///
- /// The index of the current filter, or -1 if none is selected.
+ /// The index of the current filter, or -1 if none is selected.
public int CurrentFilterIndex
{
get { return Handler.CurrentFilterIndex; }
@@ -31,11 +42,11 @@ public int CurrentFilterIndex
}
///
- /// Gets or sets the currently selected filter from the collection.
+ /// Gets or sets the currently selected filter from the collection. Also updates accordingly.
///
///
- /// This should always match an instance of a filter in the collection, otherwise
- /// the current filter will be set to null.
+ /// This can return if either the collection is ,
+ /// or if the current filter is not in the collection.
///
///
/// The current filter.
@@ -61,16 +72,23 @@ public FileFilter CurrentFilter
///
/// Some platforms may either disable (OS X) or hide (GTK/WinForms/WPF) files that do not match the currently selected filter.
///
+ ///
+ /// This is an example that would let the user select either PNG images, or all files.
+ ///
+ /// myFilePicker.Filters.Add(new FileFilter("PNG Images", "png"));
+ /// myFilePicker.Filters.Add(new FileFilter("All Files", "*"));
+ ///
+ ///
///
///
/// The filters that the user can select.
public Collection Filters
{
- get { return filters ?? (filters = new FilterCollection { Picker = this }); }
+ get { return filters ??= new FilterCollection { Picker = this }; }
}
///
- /// Gets or sets that is used when the user is selecting the file.
+ /// Gets or sets the , which indicates how the file picker should behave.
///
/// The file action.
public FileAction FileAction
@@ -80,7 +98,8 @@ public FileAction FileAction
}
///
- /// Gets or sets the full path of the file that is selected.
+ /// Gets or sets the full path of the file that was selected,
+ /// or should be selected by default when opening the picker.
///
/// The path of the file.
public string FilePath
@@ -90,7 +109,7 @@ public string FilePath
}
///
- /// Gets or sets the title of the dialog that the control will show.
+ /// Gets or sets the title of the dialog that the file picker will show.
///
/// The title of the dialog.
public string Title
@@ -100,50 +119,29 @@ public string Title
}
///
- /// Handler interface for the control
+ /// Handler interface for the control.
///
public new interface IHandler : Control.IHandler
{
- ///
- /// Gets or sets that is used when the user is selecting the file.
- ///
- /// The file action.
+ ///
FileAction FileAction { get; set; }
- ///
- /// Gets or sets the full path of the file that is selected
- ///
- /// The path of the file.
+ ///
string FilePath { get; set; }
- ///
- /// Gets or sets the index of the current filter in the collection
- ///
- /// The index of the current filter.
+ ///
int CurrentFilterIndex { get; set; }
- ///
- /// Gets or sets the title of the dialog that the control will show.
- ///
- /// The title of the dialog.
+ ///
string Title { get; set; }
- ///
- /// Clears all filters
- ///
+ ///
void ClearFilters();
-
- ///
- /// Inserts a filter at the specified index
- ///
- /// Index to insert the filter
- /// Filter to insert
+
+ ///
void InsertFilter(int index, FileFilter filter);
- ///
- /// Removes a filter at the specified index
- ///
- /// Index of the filter to remove
+ ///
void RemoveFilter(int index);
}
@@ -151,18 +149,32 @@ class FilterCollection : Collection
{
public FilePicker Picker { get; set; }
+ ///
+ /// Inserts a filter at the specified index.
+ ///
+ /// Index to insert the filter.
+ /// Filter to insert.
protected override void InsertItem(int index, FileFilter item)
{
base.InsertItem(index, item);
Picker.Handler.InsertFilter(index, item);
}
+ ///
+ /// Removes a filter at the specified index.
+ ///
+ /// Index of the filter to remove.
protected override void RemoveItem(int index)
{
base.RemoveItem(index);
Picker.Handler.RemoveFilter(index);
}
+ ///
+ /// Sets a filter at a specified index to be the provided one.
+ ///
+ /// The index whose filter should be changed.
+ /// The filter which should be set.
protected override void SetItem(int index, FileFilter item)
{
Picker.Handler.RemoveFilter(index);
@@ -170,6 +182,9 @@ protected override void SetItem(int index, FileFilter item)
Picker.Handler.InsertFilter(index, item);
}
+ ///
+ /// Clears all filters.
+ ///
protected override void ClearItems()
{
base.ClearItems();
@@ -194,7 +209,7 @@ public event EventHandler FilePathChanged
}
///
- /// Raises the event
+ /// Raises the event.
///
/// Event arguments.
protected virtual void OnFilePathChanged(EventArgs e)
@@ -205,24 +220,20 @@ protected virtual void OnFilePathChanged(EventArgs e)
// Events
///
- /// Callback interface for
+ /// Callback interface for .
///
public new interface ICallback : Control.ICallback
{
- ///
- /// Raises file path changed event.
- ///
+ ///
void OnFilePathChanged(FilePicker widget, EventArgs e);
}
///
- /// Callback implementation for handlers of
+ /// Callback implementation for handlers of .
///
protected new class Callback : Control.Callback, ICallback
{
- ///
- /// Raises file path changed event.
- ///
+ ///
public void OnFilePathChanged(FilePicker widget, EventArgs e)
{
using (widget.Platform.Context)