Gets or sets a filter string that specifies the file types and descriptions to display in the OpenFileDialog.
Assembly: System.Windows (in System.Windows.dll)
The filter string does not contain at least one vertical bar (|).
The filter extension does not contain the wildcard character (*). (Silverlight 4 only)
If the property is Empty, all files are displayed. Folders are always displayed.
consists of a description of the filter followed by a vertical bar (|) and the filter pattern. The filter can specify one or more file types.
The description describes the type of files shown in the dialog box. Although the description can be any string, it usually consists of the type of files included in the filter followed by the parentheses that contain the extensions associated with the description. The filter description appears in the drop-down list of the dialog box. The following is an example of a filter description.
My Files (*.my)
The filter pattern determines which files are shown by the dialog box. Filter patterns for the same description are separated by a semicolon (;). You can specify an exact match or use the wildcard character (*) in combination with the dot character (.) to specify file name or extension matches.
Silverlight 4 requires the wildcard character in the extension portion of the filter. Not using one will cause an exception
The following is an example of a filter description followed by multiple filter patterns. This example adds Image Files (*.bmp, *.jpg) to the drop-down list and shows .bmp and .jpg files when it is selected.
Image Files (*.bmp, *.jpg)|*.bmp;*.jpg
Multiple filter options are separated by the vertical bar.
The following is an example of multiple filter descriptions and patterns. This example adds Text Files (*.txt) and All Files (*.*) to the drop-down list. When Text Files (*.txt) is selected, .txt files are shown. When All Files (*.*) is selected, all file types are shown.
Text Files (*.txt)|*.txt|All Files (*.*)|*.*
Use the FilterIndex property to specify which filter appears first in the drop-down list. Otherwise, filter descriptions will appear in the order that they are listed in the value.
If the specified filter does not contain at least one vertical bar, an exception will occur.
Do not put spaces before or after the vertical bars in the filter string. This will cause incorrect behavior in the filter.
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.