-
Notifications
You must be signed in to change notification settings - Fork 3
FileSelect
Back to home | Back to Reference | View raw text
A control that provides a responsive and customizable UI for users to select files on their computer, similar to the " input type="file"
" element in HTML.
flowchart LR
classDef interfaceStyle stroke-dasharray: 5 5;
classDef abstractStyle stroke-width:4px
subgraph SolidShineUi
SolidShineUi.FileSelect[[FileSelect]]
end
subgraph System.Windows.Controls
System.Windows.Controls.Control[[Control]]
end
System.Windows.Controls.Control --> SolidShineUi.FileSelect
Type | Name | Methods |
---|---|---|
bool |
AllowMultipleFiles Get or set if multiple files can be selected with the FileSelect. If false, only one file can be selected. |
get, set |
Brush |
Background Get or set the brush used for the background of the control. |
get, set |
Brush |
BackgroundDisabledBrush Get or set the brush used for the background of the control (and button) when the control is disabled. |
get, set |
Brush |
BorderBrush Get or set the brush used for the border around the edges of the control. |
get, set |
Brush |
BorderDisabledBrush Get or set the brush used for the border of the control (and button) when the control is disabled. |
get, set |
string |
BrowseButtonText Get or set the text displayed in the Browse button. The default value is "Browse...". |
get, set |
Brush |
ButtonBackground Get or set the brush used for the background of the Browse button in the control. |
get, set |
Brush |
ButtonClickBrush Get or set the brush used for the background of the Browse button while the mouse is clicking it. |
get, set |
CornerRadius |
ButtonCornerRadius Get or set how much rounding to apply to the Browse button inside the control. Settings the corners to 0 means no rounding is done; straight corners are shown. |
get, set |
Brush |
ButtonHighlightBrush Get or set the brush used for the background of the Browse button while the mouse is over it. |
get, set |
PlacementDirection |
ButtonPlacement Get or set the placement location of the Browse button. The button can be placed on any of the four edges of the control, or it can be hidden entirely. |
get, set |
ColorScheme |
ColorScheme Get or set the color scheme used for this control. The color scheme can quickly apply a whole visual style to your control. |
get, set |
CornerRadius |
CornerRadius Get or set how much rounding to apply to the corners of the control. Setting the corners to 0 means no rounding is done; straight corners are shown. |
get, set |
bool |
DisplayFilenames Get or set if the filenames of the selected files are displayed. If true, then all selected files are displayed in a vertical list (with scrolling if needed). If false, then only a count is displayed (i.e. "3 file(s) selected"). |
get, set |
string |
FileFilter Get or set the file filter used when selecting files. Use semicolons (;) to separate multiple extensions/filters (i.e. *.docx;*.xlsx;*.pptx ). Supports * and ? wildcards like Windows. |
get, set |
Thickness |
FileListPadding Get or set the padding to put around the file list portion of the control (the portion that actually has the files listed). |
get, set |
ScrollBarVisibility |
HorizontalScrollBarVisibility Get or set the appearance of the horizontal scroll bar when displaying the list of filenames. Does nothing if DisplayFilenames is set to false. |
get, set |
string |
NoFilesSelectedMessage Get or set the message displayed when no files have been selected. The default value is "(no files selected)". |
get, set |
LimitableStringCollection |
SelectedFiles Get the list of files selected in this FileSelect. You can add or remove items from the collection, or set the collection's max size via the Capacity property. |
get |
bool |
ShowIcon Get or set if the file icons are shown for selected files. |
get, set |
ScrollBarVisibility |
VerticalScrollBarVisibility Get or set the appearance of the vertical scroll bar when displaying the list of filenames. Does nothing if DisplayFilenames is set to false. |
get, set |
Returns | Name |
---|---|
void |
OnColorSchemeChanged (DependencyObject d, DependencyPropertyChangedEventArgs e)Perform an action when the ColorScheme property has changed. Primarily used internally. |
Returns | Name |
---|---|
void |
ApplyColorScheme (ColorScheme cs)Apply a color scheme to this control. The color scheme can quickly apply a whole visual style to the control. |
void |
BrowseFiles ()Display an OpenFileDialog for the user to select files. |
void |
ClearAllSelectedFiles ()Clears all files from the SelectedFiles list. No files are then selected. |
void |
CopyFilenamesToClipboard ()Copy the filenames for all the selected files to the clipboard. Each file path is on its own separate line. |
void |
OpenContainingFoldersOfSelectedFiles ()Open the containing folder in Windows Explorer for each of the selected files. If multiple files are in the same folder, that folder may be opened multiple times. |
FileStream``[] |
OpenFilesForReading ()Create a file stream for each selected file, which can be used for reading the files. |
FileStream``[] |
OpenFilesForWriting ()Create a file stream for each selected file, which can be used for reading or writing the files. |
void |
SelectFiles (... )Select a file. |
A control that provides a responsive and customizable UI for users to select files on their computer, similar to the " input type="file"
" element in HTML.
Control
public FileSelect()
Create a new FileSelect control.
public static void OnColorSchemeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
Type | Name | Description |
---|---|---|
DependencyObject |
d | The object containing the property that changed. |
DependencyPropertyChangedEventArgs |
e | Event arguments about the property change. |
Perform an action when the ColorScheme property has changed. Primarily used internally.
public void ApplyColorScheme(ColorScheme cs)
Type | Name | Description |
---|---|---|
ColorScheme |
cs | The color scheme to apply. |
Apply a color scheme to this control. The color scheme can quickly apply a whole visual style to the control.
public void ClearAllSelectedFiles()
Clears all files from the SelectedFiles list. No files are then selected.
public void BrowseFiles()
Display an OpenFileDialog for the user to select files.
public void CopyFilenamesToClipboard()
Copy the filenames for all the selected files to the clipboard. Each file path is on its own separate line.
Name | Description |
---|---|
InvalidOperationException | No files are currently selected. |
public void OpenContainingFoldersOfSelectedFiles()
Open the containing folder in Windows Explorer for each of the selected files. If multiple files are in the same folder, that folder may be opened multiple times.
public void SelectFiles(string file)
Type | Name | Description |
---|---|---|
string |
file | The full path to the file. |
Select a file.
If there is no file at the specified path, it is not selected.
public void SelectFiles(IEnumerable<string> files)
Type | Name | Description |
---|---|---|
IEnumerable <string > |
files |
public FileStream OpenFilesForReading()
Create a file stream for each selected file, which can be used for reading the files.
Name | Description |
---|---|
InvalidOperationException | No files are currently selected. |
public FileStream OpenFilesForWriting()
Create a file stream for each selected file, which can be used for reading or writing the files.
Name | Description |
---|---|
InvalidOperationException | No files are currently selected. |
public ColorScheme ColorScheme { get; set; }
Get or set the color scheme used for this control. The color scheme can quickly apply a whole visual style to your control.
public Brush Background { get; set; }
Get or set the brush used for the background of the control.
public Brush ButtonBackground { get; set; }
Get or set the brush used for the background of the Browse button in the control.
public Brush ButtonHighlightBrush { get; set; }
Get or set the brush used for the background of the Browse button while the mouse is over it.
public Brush ButtonClickBrush { get; set; }
Get or set the brush used for the background of the Browse button while the mouse is clicking it.
public Brush BackgroundDisabledBrush { get; set; }
Get or set the brush used for the background of the control (and button) when the control is disabled.
public Brush BorderDisabledBrush { get; set; }
Get or set the brush used for the border of the control (and button) when the control is disabled.
public Brush BorderBrush { get; set; }
Get or set the brush used for the border around the edges of the control.
public CornerRadius CornerRadius { get; set; }
Get or set how much rounding to apply to the corners of the control. Setting the corners to 0 means no rounding is done; straight corners are shown.
public CornerRadius ButtonCornerRadius { get; set; }
Get or set how much rounding to apply to the Browse button inside the control. Settings the corners to 0 means no rounding is done; straight corners are shown.
public string BrowseButtonText { get; set; }
Get or set the text displayed in the Browse button. The default value is "Browse...".
public string NoFilesSelectedMessage { get; set; }
Get or set the message displayed when no files have been selected. The default value is "(no files selected)".
public bool ShowIcon { get; set; }
Get or set if the file icons are shown for selected files.
public PlacementDirection ButtonPlacement { get; set; }
Get or set the placement location of the Browse button. The button can be placed on any of the four edges of the control, or it can be hidden entirely.
public bool DisplayFilenames { get; set; }
Get or set if the filenames of the selected files are displayed. If true, then all selected files are displayed in a vertical list (with scrolling if needed). If false, then only a count is displayed (i.e. "3 file(s) selected").
public ScrollBarVisibility HorizontalScrollBarVisibility { get; set; }
Get or set the appearance of the horizontal scroll bar when displaying the list of filenames. Does nothing if DisplayFilenames
is set to false.
public ScrollBarVisibility VerticalScrollBarVisibility { get; set; }
Get or set the appearance of the vertical scroll bar when displaying the list of filenames. Does nothing if DisplayFilenames
is set to false.
public Thickness FileListPadding { get; set; }
Get or set the padding to put around the file list portion of the control (the portion that actually has the files listed).
This can be used to add some space between the Browse button and the list of files, in situations where the two in contact may lead to undesirable results.
public LimitableStringCollection SelectedFiles { get; }
Get the list of files selected in this FileSelect. You can add or remove items from the collection, or set the collection's max size via the Capacity
property.
public string FileFilter { get; set; }
Get or set the file filter used when selecting files. Use semicolons (;) to separate multiple extensions/filters (i.e. *.docx;*.xlsx;*.pptx
). Supports * and ? wildcards like Windows.
If the filter is changed after files have been selected, the existing selected files are not re-run against the new filter. This only applies to files added in afterwards.
public bool AllowMultipleFiles { get; set; }
Get or set if multiple files can be selected with the FileSelect. If false, only one file can be selected.
If you want to set a specific max number of files that can be selected, set this to "true" and then set the max value via the SelectedFiles.Capacity
property.
public event DependencyPropertyChangedEventHandler ColorSchemeChanged
Raised when the ColorScheme property is changed.
protected event DependencyPropertyChangedEventHandler InternalCornerRadiusChanged
Internal event for handling a property changed. Please view the event that is not prefixed as "Internal".
public event RoutedEventHandler CornerRadiusChanged
Raised when the CornerRadius property is changed.
public event RoutedEventHandler SelectionChanged
Raised when the list of selected files is changed.
protected event DependencyPropertyChangedEventHandler InternalAllowMultipleFilesChanged
Internal event for handling a property changed. Please view the event that is not prefixed as "Internal".
public event DependencyPropertyChangedEventHandler AllowMultipleFilesChanged
Raised when the AllowMultipleFiles property is changed.
Generated with ModularDoc