xtd 0.2.0
xtd::forms::file_dialog Class Referenceabstract

Definition

Displays a dialog box from which the user can select a file.

Header
#include <xtd/forms/file_dialog>
Namespace
xtd::forms
Library
xtd.forms
Remarks
file_dialog is an abstract class that contains common behavior for the open_file_dialog and save_file_dialog classes. It is not intended to be used directly but contains common behavior for those two classes. You cannot create an instance of file_dialog. Although the class is declared public, you cannot inherit from it, as it contains private abstract methods. To create a dialog box to select or save a file, use open_file_dialog or save_file_dialog.
file_dialog is a modal dialog box; therefore, when shown, it blocks the rest of the application until the user has chosen a file. When a dialog box is displayed modally, no input (keyboard or mouse click) can occur except to objects on the dialog box. The program must hide or close the dialog box (usually in response to some user action) before input to the calling program can occur.
Warning
When you use classes derived from file_dialog, such as open_file_dialog and save_file_dialog, avoid using string literals containing absolute paths. Instead, dynamically obtain the path using one or more of the techniques described in the following table.
Remarks
If you want to enable users to select a folder instead of a file, use the folder_browser_dialog.
Depending upon the type of application, how data associated with the application is stored, and the reason for accessing the file system, there are many possible ways in which you can create a directory path. The following table shows the techniques for creating paths dynamically.
Path or program category Class and members to use
Standard Windows paths, such as Program Files, MyDocuments, the Desktop and so on The xtd::environment class is the most complete source for these, either through its static methods, such as system_directory, or through the get_folder_path method, using one of the environment::special_folder enumerated values.
Paths related to the current application The application class has static members to obtain certain paths, such as startup_path, executable_path, local_user_app_data_path, and common_app_data_path.

The get_temp_path method of the xtd::io::path returns the path of the temporary folder.

The get_current_directory method of the xtd::io::directory class returns the application's current executing directory.

The root_directory property of the drive_info class represents the specified drive's root directory.
Paths stored as application settings Access the corresponding applications settings property of the wrapper class derived from application_settings_base. For more information, see application settings for Windows Forms.
Registry storage Some applications store directory information in the registry. The Application class has the common_ app_data_path and local_user_app_data_path properties that resolve to a registry_key value.
ClickOnce applications For click_once applications, use application class members such as user_app_data_path, which will return a pointer to the click_once data directory. For more information, see accessing local and remote data in click_once applications.
International applications For international applications, retrieve the relative path portion from a string resource in your application by using the xtd::resources::resource_reader class. For more information about globalization and localization
Notice that a full path may be built up using one or more of the described techniques. For example, the get_folder_path method might be used to obtain the path to the MyDocuments folder, then an application setting may be used to add a relative subdirectory portion.
The xtd::io::path class contains static members to assist in manipulating absolute and relative path strings, whereas the System.IO.File and xtd::io::directory classes have static members that actually manipulate files and directories, respectively.
Important
If the user of your application changes the folder in the file_dialog, then the current working directory for your application is set to the location specified in the file_dialog. To prevent this, set the restore_directory property to true.

Constructors

 file_dialog ()
 Initializes a new instance of the common_dialog class. More...
 

Properties

virtual bool add_extension () const noexcept
 Gets a value indicating whether the dialog box automatically adds an extension to a file name if the user omits the extension. More...
 
virtual file_dialogadd_extension (bool value)
 Sets a value indicating whether the dialog box automatically adds an extension to a file name if the user omits the extension. More...
 
virtual bool auto_upgrade_enabled () const noexcept
 Gets a value indicating whether this file_dialog instance should automatically upgrade appearance and behavior when running on Windows Vista. More...
 
virtual file_dialogauto_upgrade_enabled (bool value)
 Sets a value indicating whether this file_dialog instance should automatically upgrade appearance and behavior when running on Windows Vista. More...
 
virtual bool check_file_exists () const noexcept
 Gets a value indicating whether the dialog box displays a warning if the user specifies a file name that does not exist. More...
 
virtual file_dialogcheck_file_exists (bool value)
 Sets a value indicating whether the dialog box displays a warning if the user specifies a file name that does not exist. More...
 
virtual bool check_path_exists () const noexcept
 Gets a value indicating whether the dialog box displays a warning if the user specifies a path that does not exist. More...
 
virtual file_dialogcheck_path_exists (bool value)
 Sets a value indicating whether the dialog box displays a warning if the user specifies a path that does not exist. More...
 
virtual const xtd::ustringdefault_ext () const noexcept
 Gets the default file name extension. More...
 
virtual file_dialogdefault_ext (const xtd::ustring &value)
 Sets the default file name extension. More...
 
virtual bool dereference_link () const noexcept
 Gets a value indicating whether the dialog box returns the location of the file referenced by the shortcut or whether it returns the location of the shortcut (.lnk). More...
 
virtual file_dialogdereference_link (bool value)
 Sets a value indicating whether the dialog box returns the location of the file referenced by the shortcut or whether it returns the location of the shortcut (.lnk). More...
 
virtual const xtd::ustringfile_name () const noexcept
 Gets a string containing the file name selected in the file dialog box. More...
 
virtual file_dialogfile_name (const xtd::ustring &value)
 Sets a string containing the file name selected in the file dialog box. More...
 
virtual const std::vector< xtd::ustringfile_names () const noexcept
 Gets the file names of all selected files in the dialog box. More...
 
virtual const xtd::ustringfilter () const noexcept
 Gets the current file name filter string, which determines the choices that appear in the "Save as file type" or "Files of type" box in the dialog box. More...
 
virtual file_dialogfilter (const xtd::ustring &value)
 Sets the current file name filter string, which determines the choices that appear in the "Save as file type" or "Files of type" box in the dialog box. More...
 
virtual size_t filter_index () const noexcept
 Gets the index of the filter currently selected in the file dialog box. More...
 
virtual file_dialogfilter_index (size_t value)
 Sets the index of the filter currently selected in the file dialog box. More...
 
virtual const xtd::ustringinitial_directory () const noexcept
 Gets the initial directory displayed by the file dialog box. More...
 
virtual file_dialoginitial_directory (const xtd::ustring &value)
 Sets the initial directory displayed by the file dialog box. More...
 
size_t options () const noexcept
 Gets values to initialize the file_dialog. More...
 
virtual bool restore_directory () const noexcept
 Gets a value indicating whether the dialog box restores the directory to the previously selected directory before closing. More...
 
virtual file_dialogrestore_directory (bool value)
 Sets a value indicating whether the dialog box restores the directory to the previously selected directory before closing. More...
 
virtual bool show_help () const noexcept
 Gets a value indicating whether the Help button is displayed in the file dialog box. More...
 
virtual file_dialogshow_help (bool value)
 Sets a value indicating whether the Help button is displayed in the file dialog box. More...
 
virtual bool show_hidden_files () const noexcept
 Gets a value indicating whether hidden files are displayed in the file dialog box. More...
 
virtual file_dialogshow_hidden_files (bool value)
 Sets a value indicating whether hidden files are displayed in the file dialog box. More...
 
virtual bool show_preview () const noexcept
 Gets a value indicating whether preview file is displayed in the file dialog box. More...
 
virtual file_dialogshow_preview (bool value)
 Sets a value indicating whether preview file is displayed in the file dialog box. More...
 
virtual bool support_multi_dotted_extensions () const noexcept
 Gets whether the dialog box supports displaying and saving files that have multiple file name extensions.Gets or sets whether the dialog box supports displaying and saving files that have multiple file name extensions. More...
 
virtual file_dialogsupport_multi_dotted_extensions (bool value)
 Sets whether the dialog box supports displaying and saving files that have multiple file name extensions.Gets or sets whether the dialog box supports displaying and saving files that have multiple file name extensions. More...
 
virtual const xtd::ustringtitle () const noexcept
 Gets the file dialog box title. More...
 
virtual file_dialogtitle (const xtd::ustring &value)
 Sets the file dialog box title. More...
 
virtual bool validate_names () const noexcept
 Gets a value indicating whether the dialog box accepts only valid file names. More...
 
virtual file_dialogvalidate_names (bool value)
 Gets a value indicating whether the dialog box accepts only valid file names. More...
 

Methods

void reset () noexcept override
 Resets all properties to their default values. More...
 
xtd::ustring to_string () const noexcept override
 Provides a string version of this object. More...
 

Protected methods

bool run_dialog (intptr hwnd_owner) override
 Runs file dialog box. More...
 
void run_sheet (intptr hwnd_owner) override
 Runs file dialog box in sheet mode. More...
 

Additional Inherited Members

- Public Attributes inherited from xtd::forms::common_dialog
event< common_dialog, help_event_handlerhelp_request
 Occurs when the user clicks the Help button on a common dialog box. More...
 
event< common_dialog, dialog_closed_event_handlerdialog_closed
 Occurs when the user close a common dialog box with dialog close button or other dialog buttons. More...
 
- Public Member Functions inherited from xtd::forms::common_dialog
 common_dialog ()
 Initializes a new instance of the common_dialog class. More...
 
xtd::forms::dialog_result dialog_result () const noexcept
 Gets async dialog_result result after dialog box is closing. More...
 
std::any tag () const noexcept
 Gets an object that contains data about the control. More...
 
common_dialogtag (const std::any &tag)
 Sets an object that contains data about the control. More...
 
xtd::forms::dialog_result show_dialog ()
 Runs a common dialog box with a default owner. More...
 
xtd::forms::dialog_result show_dialog (const iwin32_window &owner)
 Runs a common dialog box with the specified owner. More...
 
void show_sheet (const iwin32_window &owner)
 Runs a common dialog box with the specified owner. More...
 
xtd::forms::dialog_result show_sheet_dialog (const iwin32_window &owner)
 Runs a common dialog box with the specified owner. More...
 
- Public Member Functions inherited from xtd::object
 object ()=default
 Create a new instance of the ultimate base class object. More...
 
bool equals (const object &obj) const noexcept
 Determines whether the specified object is equal to the current object. More...
 
virtual size_t get_hash_code () const noexcept
 Serves as a hash function for a particular type. More...
 
virtual type_object get_type () const noexcept
 Gets the type of the current instance. More...
 
template<typename object_t >
std::unique_ptr< object_t > memberwise_clone () const noexcept
 Creates a shallow copy of the current object. More...
 
- Static Public Member Functions inherited from xtd::object
static bool equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are considered equal. More...
 
static bool reference_equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are the same instance. More...
 
- Protected Member Functions inherited from xtd::forms::common_dialog
virtual void on_dialog_closed (const dialog_closed_event_args &e)
 Raises the common_dialog::dialog_close event. More...
 
virtual void on_help_request (help_event_args &e)
 Raises the common_dialog::help_request event. More...
 
void set_dialog_result (xtd::forms::dialog_result value)
 Sets async dialog_result result after dialog box is closing. More...
 
- Protected Member Functions inherited from xtd::forms::component
 component ()
 Initialises a new instance of the component class. More...
 
virtual bool can_raise_events () const noexcept
 Gets a value indicating whether the component can raise an event. More...
 
bool design_mode () const noexcept
 Gets a value that indicates whether the component is currently in design mode. More...
 

Constructor & Destructor Documentation

◆ file_dialog()

xtd::forms::file_dialog::file_dialog ( )

Initializes a new instance of the common_dialog class.

Member Function Documentation

◆ add_extension() [1/2]

virtual bool xtd::forms::file_dialog::add_extension ( ) const
virtualnoexcept

Gets a value indicating whether the dialog box automatically adds an extension to a file name if the user omits the extension.

Returns
true if the dialog box adds an extension to a file name if the user omits the extension; otherwise, false. The default value is true.

◆ add_extension() [2/2]

virtual file_dialog& xtd::forms::file_dialog::add_extension ( bool  value)
virtual

Sets a value indicating whether the dialog box automatically adds an extension to a file name if the user omits the extension.

Parameters
valuetrue if the dialog box adds an extension to a file name if the user omits the extension; otherwise, false. The default value is true.
Returns
Current file_dialog.

◆ auto_upgrade_enabled() [1/2]

virtual bool xtd::forms::file_dialog::auto_upgrade_enabled ( ) const
virtualnoexcept

Gets a value indicating whether this file_dialog instance should automatically upgrade appearance and behavior when running on Windows Vista.

Returns
true if this file_dialog instance should automatically upgrade appearance and behavior when running on Windows Vista; otherwise, false. The default is true.
Remarks
If this property is false, the file_dialog class will have a Windows XP-style appearance and behavior on Windows Vista.
On Windows XP, this property does not have any effect.

◆ auto_upgrade_enabled() [2/2]

virtual file_dialog& xtd::forms::file_dialog::auto_upgrade_enabled ( bool  value)
virtual

Sets a value indicating whether this file_dialog instance should automatically upgrade appearance and behavior when running on Windows Vista.

Parameters
valuetrue if this file_dialog instance should automatically upgrade appearance and behavior when running on Windows Vista; otherwise, false. The default is true.
Returns
Current file_dialog.
Remarks
If this property is false, the file_dialog class will have a Windows XP-style appearance and behavior on Windows Vista.
On Windows XP, this property does not have any effect.

◆ check_file_exists() [1/2]

virtual bool xtd::forms::file_dialog::check_file_exists ( ) const
virtualnoexcept

Gets a value indicating whether the dialog box displays a warning if the user specifies a file name that does not exist.

Returns
true if the dialog box displays a warning if the user specifies a file name that does not exist; otherwise, false. The default value is false.
Remarks
The default value is true for an inheriting open_file_dialog and false for an inheriting save_file_dialog.

◆ check_file_exists() [2/2]

virtual file_dialog& xtd::forms::file_dialog::check_file_exists ( bool  value)
virtual

Sets a value indicating whether the dialog box displays a warning if the user specifies a file name that does not exist.

Parameters
valuetrue if the dialog box displays a warning if the user specifies a file name that does not exist; otherwise, false. The default value is false.
Returns
Current file_dialog.
Remarks
The default value is true for an inheriting open_file_dialog and false for an inheriting save_file_dialog.

◆ check_path_exists() [1/2]

virtual bool xtd::forms::file_dialog::check_path_exists ( ) const
virtualnoexcept

Gets a value indicating whether the dialog box displays a warning if the user specifies a path that does not exist.

Returns
true if the dialog box displays a warning when the user specifies a path that does not exist; otherwise, false. The default value is true.

◆ check_path_exists() [2/2]

virtual file_dialog& xtd::forms::file_dialog::check_path_exists ( bool  value)
virtual

Sets a value indicating whether the dialog box displays a warning if the user specifies a path that does not exist.

Parameters
valuetrue if the dialog box displays a warning when the user specifies a path that does not exist; otherwise, false. The default value is true.
Returns
Current file_dialog.

◆ default_ext() [1/2]

virtual const xtd::ustring& xtd::forms::file_dialog::default_ext ( ) const
virtualnoexcept

Gets the default file name extension.

Returns
The default file name extension. The returned string does not include the period. The default value is an empty string ("").
Remarks
When the user of your application specifies a file name without an extension, the file_dialog appends an extension to the file name. The extension that is used is determined by the filter and default_ext properties. If a filter is selected in the file_dialog and the filter specifies an extension, then that extension is used. If the filter selected uses a wildcard in place of the extension, then the extension specified in the default_ext property is used.

◆ default_ext() [2/2]

virtual file_dialog& xtd::forms::file_dialog::default_ext ( const xtd::ustring value)
virtual

Sets the default file name extension.

Parameters
valueThe default file name extension. The returned string does not include the period. The default value is an empty string ("").
Remarks
When the user of your application specifies a file name without an extension, the file_dialog appends an extension to the file name. The extension that is used is determined by the filter and default_ext properties. If a filter is selected in the file_dialog and the filter specifies an extension, then that extension is used. If the filter selected uses a wildcard in place of the extension, then the extension specified in the default_ext property is used.
Returns
Current file_dialog.

◆ dereference_link() [1/2]

virtual bool xtd::forms::file_dialog::dereference_link ( ) const
virtualnoexcept

Gets a value indicating whether the dialog box returns the location of the file referenced by the shortcut or whether it returns the location of the shortcut (.lnk).

Returns
true if the dialog box returns the location of the file referenced by the shortcut; otherwise, false. The default value is true.

◆ dereference_link() [2/2]

virtual file_dialog& xtd::forms::file_dialog::dereference_link ( bool  value)
virtual

Sets a value indicating whether the dialog box returns the location of the file referenced by the shortcut or whether it returns the location of the shortcut (.lnk).

Parameters
valuetrue if the dialog box returns the location of the file referenced by the shortcut; otherwise, false. The default value is true.
Returns
Current file_dialog.

◆ file_name() [1/2]

virtual const xtd::ustring& xtd::forms::file_dialog::file_name ( ) const
virtualnoexcept

Gets a string containing the file name selected in the file dialog box.

Returns
The file name selected in the file dialog box. The default value is an empty string ("").
Remarks
The file name includes both the file path and the extension. If no files are selected, this method returns an empty string ("").
When used from the save_file_dialog class, this property represents the file being saved; when used from the open_file_dialog class, it represents the file being opened.
This property can only be the name of one selected file. If you want to return an array containing the names of all selected files in a multiple-selection dialog box, use file_names.
Examples:
painting.cpp.

◆ file_name() [2/2]

virtual file_dialog& xtd::forms::file_dialog::file_name ( const xtd::ustring value)
virtual

Sets a string containing the file name selected in the file dialog box.

Parameters
valueThe file name selected in the file dialog box. The default value is an empty string ("").
Returns
Current file_dialog.
Remarks
The file name includes both the file path and the extension. If no files are selected, this method returns an empty string ("").
When used from the save_file_dialog class, this property represents the file being saved; when used from the open_file_dialog class, it represents the file being opened.
This property can only be the name of one selected file. If you want to return an array containing the names of all selected files in a multiple-selection dialog box, use file_names.

◆ file_names()

virtual const std::vector<xtd::ustring> xtd::forms::file_dialog::file_names ( ) const
virtualnoexcept

Gets the file names of all selected files in the dialog box.

Returns
An array of type string, containing the file names of all selected files in the dialog box.
Remarks
Each file name includes both the file path and the extension. If no files are selected, this method returns an empty array.
Examples:
image_list.cpp.

◆ filter() [1/2]

virtual const xtd::ustring& xtd::forms::file_dialog::filter ( ) const
virtualnoexcept

Gets the current file name filter string, which determines the choices that appear in the "Save as file type" or "Files of type" box in the dialog box.

Returns
The file filtering options available in the dialog box.
Remarks
For each filtering option, the filter string contains a description of the filter, followed by the vertical bar (|) and the filter pattern. The strings for different filtering options are separated by the vertical bar.
The following is an example of a filter string:
Text files (*.txt)|*.txt|All files (*.*)|*.* 
You can add several filter patterns to a filter by separating the file types with semicolons, for example:
Image Files(*.BMP;*.JPG;*.GIF)|*.BMP;*.JPG;*.GIF|All files (*.*)|*.* 
Use the filter_index property to set which filtering option is shown first to the user.
Examples:
image_list.cpp.

◆ filter() [2/2]

virtual file_dialog& xtd::forms::file_dialog::filter ( const xtd::ustring value)
virtual

Sets the current file name filter string, which determines the choices that appear in the "Save as file type" or "Files of type" box in the dialog box.

Parameters
valueThe file filtering options available in the dialog box.
Returns
Current file_dialog.
Remarks
For each filtering option, the filter string contains a description of the filter, followed by the vertical bar (|) and the filter pattern. The strings for different filtering options are separated by the vertical bar.
The following is an example of a filter string:
Text files (*.txt)|*.txt|All files (*.*)|*.* 
You can add several filter patterns to a filter by separating the file types with semicolons, for example:
Image Files(*.BMP;*.JPG;*.GIF)|*.BMP;*.JPG;*.GIF|All files (*.*)|*.* 
Use the filter_index property to set which filtering option is shown first to the user.

◆ filter_index() [1/2]

virtual size_t xtd::forms::file_dialog::filter_index ( ) const
virtualnoexcept

Gets the index of the filter currently selected in the file dialog box.

Returns
A value containing the index of the filter currently selected in the file dialog box. The default value is 1.
Remarks
Use the filter_index property to set which filtering option is shown first to the user. You can also use the value of filter_index after showing the file dialog to perform special file operations depending upon the filter chosen.
Note
The index value of the first filter entry is 1.

◆ filter_index() [2/2]

virtual file_dialog& xtd::forms::file_dialog::filter_index ( size_t  value)
virtual

Sets the index of the filter currently selected in the file dialog box.

Parameters
valueA value containing the index of the filter currently selected in the file dialog box. The default value is 1.
Returns
Current file_dialog.
Remarks
Use the filter_index property to set which filtering option is shown first to the user. You can also use the value of filter_index after showing the file dialog to perform special file operations depending upon the filter chosen.
Note
The index value of the first filter entry is 1.

◆ initial_directory() [1/2]

virtual const xtd::ustring& xtd::forms::file_dialog::initial_directory ( ) const
virtualnoexcept

Gets the initial directory displayed by the file dialog box.

Returns
The initial directory displayed by the file dialog box. The default is an empty string ("").
Remarks
The InitialDirectory property is typically set using one of the following sources:
  • A path that was previously used in the program, perhaps retained from the last directory or file operation.
  • A path read from a persistent source, such as an application setting, a Registry or a string resource in the application.
  • Standard Windows, macOs or linux system and user paths, such as Program Files, MyDocuments, MyMusic, and so on (which you can obtain using the xtd::environment::get_folder_path method)
  • A path related to the current application, such as its startup directory (which you can obtain using properties on the xtd::forms::application object).
Examples:
open_file_dialog.cpp, and save_file_dialog.cpp.

◆ initial_directory() [2/2]

virtual file_dialog& xtd::forms::file_dialog::initial_directory ( const xtd::ustring value)
virtual

Sets the initial directory displayed by the file dialog box.

Parameters
valueThe initial directory displayed by the file dialog box. The default is an empty string ("").
Returns
Current file_dialog.
Remarks
The InitialDirectory property is typically set using one of the following sources:
  • A path that was previously used in the program, perhaps retained from the last directory or file operation.
  • A path read from a persistent source, such as an application setting, a Registry or a string resource in the application.
  • Standard Windows, macOs or linux system and user paths, such as Program Files, MyDocuments, MyMusic, and so on (which you can obtain using the xtd::environment::get_folder_path method)
  • A path related to the current application, such as its startup directory (which you can obtain using properties on the xtd::forms::application object).

◆ options()

size_t xtd::forms::file_dialog::options ( ) const
noexcept

Gets values to initialize the file_dialog.

Returns
A bitwise combination of internal values that initializes the file_dialog.
The options property corresponds to the flags used to initialize a color dialog box using Win32. Use the properties of the file_dialog class to get and set the options.

◆ reset()

void xtd::forms::file_dialog::reset ( )
overridevirtualnoexcept

Resets all properties to their default values.

Remarks
When overriding reset() in a derived class, be sure to call the base class's reset() method.

Implements xtd::forms::common_dialog.

◆ restore_directory() [1/2]

virtual bool xtd::forms::file_dialog::restore_directory ( ) const
virtualnoexcept

Gets a value indicating whether the dialog box restores the directory to the previously selected directory before closing.

Returns
true if the dialog box restores the current directory to the previously selected directory if the user changed the directory while searching for files; otherwise, false. The default value is false.

◆ restore_directory() [2/2]

virtual file_dialog& xtd::forms::file_dialog::restore_directory ( bool  value)
virtual

Sets a value indicating whether the dialog box restores the directory to the previously selected directory before closing.

Parameters
valuetrue if the dialog box restores the current directory to the previously selected directory if the user changed the directory while searching for files; otherwise, false. The default value is false.
Returns
Current file_dialog.

◆ run_dialog()

bool xtd::forms::file_dialog::run_dialog ( intptr  hwnd_owner)
overrideprotectedvirtual

Runs file dialog box.

Parameters
hwnd_ownerA value that represents the window handle of the owner window for the common dialog box.
Returns
true if the file could be opened; otherwise, false.
Remarks
This method provides an implementation of run_dialog, and is invoked when the user of a file dialog invokes show_dialog.

Implements xtd::forms::common_dialog.

◆ run_sheet()

void xtd::forms::file_dialog::run_sheet ( intptr  hwnd_owner)
overrideprotectedvirtual

Runs file dialog box in sheet mode.

Parameters
hwnd_ownerA value that represents the window handle of the owner window for the common dialog box.

Implements xtd::forms::common_dialog.

◆ show_help() [1/2]

virtual bool xtd::forms::file_dialog::show_help ( ) const
virtualnoexcept

Gets a value indicating whether the Help button is displayed in the file dialog box.

Returns
true if the dialog box includes a help button; otherwise, false. The default value is false.
Remarks
A xtd::forms::control::help_requested event is raised when the user clicks the Help button.

◆ show_help() [2/2]

virtual file_dialog& xtd::forms::file_dialog::show_help ( bool  value)
virtual

Sets a value indicating whether the Help button is displayed in the file dialog box.

Parameters
valuetrue if the dialog box includes a help button; otherwise, false. The default value is false.
Returns
Current file_dialog.
Remarks
A xtd::forms::control::help_requested event is raised when the user clicks the Help button.

◆ show_hidden_files() [1/2]

virtual bool xtd::forms::file_dialog::show_hidden_files ( ) const
virtualnoexcept

Gets a value indicating whether hidden files are displayed in the file dialog box.

Returns
true if the dialog box includes hidden files; otherwise, false. The default value is false.

◆ show_hidden_files() [2/2]

virtual file_dialog& xtd::forms::file_dialog::show_hidden_files ( bool  value)
virtual

Sets a value indicating whether hidden files are displayed in the file dialog box.

Parameters
valuetrue if the dialog box includes hidden files; otherwise, false. The default value is false.
Returns
Current file_dialog.

◆ show_preview() [1/2]

virtual bool xtd::forms::file_dialog::show_preview ( ) const
virtualnoexcept

Gets a value indicating whether preview file is displayed in the file dialog box.

Returns
true if the dialog box includes preview file; otherwise, false. The default value is false.

◆ show_preview() [2/2]

virtual file_dialog& xtd::forms::file_dialog::show_preview ( bool  value)
virtual

Sets a value indicating whether preview file is displayed in the file dialog box.

Parameters
valuetrue if the dialog box includes preview file; otherwise, false. The default value is false.
Returns
Current file_dialog.

◆ support_multi_dotted_extensions() [1/2]

virtual bool xtd::forms::file_dialog::support_multi_dotted_extensions ( ) const
virtualnoexcept

Gets whether the dialog box supports displaying and saving files that have multiple file name extensions.Gets or sets whether the dialog box supports displaying and saving files that have multiple file name extensions.

Returns
true if the dialog box supports multiple file name extensions; otherwise, false. The default is false.
Remarks
Sometimes users must open and save files that use multiple file name extensions. For example, the application manifest files used by the click_once deployment technology end in the complex file name extension ".exe.manifest". Setting this property to true enables you to set the FFilter property to a multi-dotted extension.
If support_multi_dotted_extensions is false, and you assign a multi-dotted extension to Filter, derived controls such as save_file_dialog will only use the last extension in the string. For example, ".manifest" will be used instead of ".exe.manifest".

◆ support_multi_dotted_extensions() [2/2]

virtual file_dialog& xtd::forms::file_dialog::support_multi_dotted_extensions ( bool  value)
virtual

Sets whether the dialog box supports displaying and saving files that have multiple file name extensions.Gets or sets whether the dialog box supports displaying and saving files that have multiple file name extensions.

Parameters
valuetrue if the dialog box supports multiple file name extensions; otherwise, false. The default is false.
Returns
Current file_dialog.
Remarks
Sometimes users must open and save files that use multiple file name extensions. For example, the application manifest files used by the click_once deployment technology end in the complex file name extension ".exe.manifest". Setting this property to true enables you to set the FFilter property to a multi-dotted extension.
If support_multi_dotted_extensions is false, and you assign a multi-dotted extension to Filter, derived controls such as save_file_dialog will only use the last extension in the string. For example, ".manifest" will be used instead of ".exe.manifest".

◆ title() [1/2]

virtual const xtd::ustring& xtd::forms::file_dialog::title ( ) const
virtualnoexcept

Gets the file dialog box title.

Returns
The file dialog box title. The default value is an empty string ("").
Remarks
The string is placed in the title bar of the dialog box. If the title is an empty string, the system uses a default title, which is either "Save As" or "Open".

◆ title() [2/2]

virtual file_dialog& xtd::forms::file_dialog::title ( const xtd::ustring value)
virtual

Sets the file dialog box title.

Parameters
valueThe file dialog box title. The default value is an empty string ("").
Returns
Current file_dialog.
Remarks
The string is placed in the title bar of the dialog box. If the title is an empty string, the system uses a default title, which is either "Save As" or "Open".

◆ to_string()

xtd::ustring xtd::forms::file_dialog::to_string ( ) const
overridevirtualnoexcept

Provides a string version of this object.

Returns
A string version of this object.

Reimplemented from xtd::object.

◆ validate_names() [1/2]

virtual bool xtd::forms::file_dialog::validate_names ( ) const
virtualnoexcept

Gets a value indicating whether the dialog box accepts only valid file names.

Returns
true if the dialog box accepts only valid file names; otherwise, false. The default value is true.
Remarks
If the edit control contains anything but spaces when the user clicks OK, the dialog box returns the file name, whether it is valid or not. No default extension is added to the text.

◆ validate_names() [2/2]

virtual file_dialog& xtd::forms::file_dialog::validate_names ( bool  value)
virtual

Gets a value indicating whether the dialog box accepts only valid file names.

Parameters
valuetrue if the dialog box accepts only valid file names; otherwise, false. The default value is true.
Returns
Current file_dialog.
Remarks
If the edit control contains anything but spaces when the user clicks OK, the dialog box returns the file name, whether it is valid or not. No default extension is added to the text.

The documentation for this class was generated from the following file: