Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
293 lines (279 sloc) 18.6 KB
<Type Name="OpenFileDialog" FullName="Microsoft.Win32.OpenFileDialog">
<TypeSignature Language="C#" Value="public sealed class OpenFileDialog : Microsoft.Win32.FileDialog" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi sealed beforefieldinit OpenFileDialog extends Microsoft.Win32.FileDialog" />
<TypeSignature Language="DocId" Value="T:Microsoft.Win32.OpenFileDialog" />
<TypeSignature Language="VB.NET" Value="Public NotInheritable Class OpenFileDialog&#xA;Inherits FileDialog" />
<TypeSignature Language="C++ CLI" Value="public ref class OpenFileDialog sealed : Microsoft::Win32::FileDialog" />
<TypeSignature Language="F#" Value="type OpenFileDialog = class&#xA; inherit FileDialog" />
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>Microsoft.Win32.FileDialog</BaseTypeName>
</Base>
<Interfaces />
<Docs>
<summary>Represents a common dialog box that allows a user to specify a filename for one or more files to open.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The following figure shows an <xref:Microsoft.Win32.OpenFileDialog> for [!INCLUDE[TLA#tla_winvista](~/includes/tlasharptla-winvista-md.md)].
![Open dialog box](~/add/media/dialogboxesoverviewfigure2.png "Open dialog box")
Starting in [!INCLUDE[TLA2#tla_winvista](~/includes/tla2sharptla-winvista-md.md)], open and save file dialog boxes have a **Favorite Links** panel on the left side of the dialog box that allows the user to quickly navigate to a different location. These links are called custom places. Use the <xref:Microsoft.Win32.FileDialog.CustomPlaces%2A> property to set this list of links.
<a name="xamlTextUsage_OpenFileDialog"></a>
## XAML Text Usage
You cannot declare this managed class in [!INCLUDE[TLA2#tla_xaml](~/includes/tla2sharptla-xaml-md.md)].
## Examples
The following example shows how to create an <xref:Microsoft.Win32.OpenFileDialog> that contains a default file name and extension type.
[!code-csharp[DialogBoxesOverviewSnippets#OpenFileDialogBoxCODEBEHIND](~/samples/snippets/csharp/VS_Snippets_Wpf/DialogBoxesOverviewSnippets/CSharp/Window1.xaml.cs#openfiledialogboxcodebehind)]
[!code-vb[DialogBoxesOverviewSnippets#OpenFileDialogBoxCODEBEHIND](~/samples/snippets/visualbasic/VS_Snippets_Wpf/DialogBoxesOverviewSnippets/VisualBasic/window1.xaml.vb#openfiledialogboxcodebehind)]
]]></format>
</remarks>
<altmember cref="T:Microsoft.Win32.SaveFileDialog" />
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public OpenFileDialog ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Win32.OpenFileDialog.#ctor" />
<MemberSignature Language="VB.NET" Value="Public Sub New ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; OpenFileDialog();" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Security.SecurityCritical</AttributeName>
</Attribute>
</Attributes>
<Parameters />
<Docs>
<summary>Initializes a new instance of the <see cref="T:Microsoft.Win32.OpenFileDialog" /> class.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="CheckPermissionsToShowDialog">
<MemberSignature Language="C#" Value="protected override void CheckPermissionsToShowDialog ();" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void CheckPermissionsToShowDialog() cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Win32.OpenFileDialog.CheckPermissionsToShowDialog" />
<MemberSignature Language="VB.NET" Value="Protected Overrides Sub CheckPermissionsToShowDialog ()" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; override void CheckPermissionsToShowDialog();" />
<MemberSignature Language="F#" Value="override this.CheckPermissionsToShowDialog : unit -&gt; unit" Usage="openFileDialog.CheckPermissionsToShowDialog " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Security.SecurityCritical</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Security.SecurityTreatAsSafe</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="Multiselect">
<MemberSignature Language="C#" Value="public bool Multiselect { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool Multiselect" />
<MemberSignature Language="DocId" Value="P:Microsoft.Win32.OpenFileDialog.Multiselect" />
<MemberSignature Language="VB.NET" Value="Public Property Multiselect As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property bool Multiselect { bool get(); void set(bool value); };" />
<MemberSignature Language="F#" Value="member this.Multiselect : bool with get, set" Usage="Microsoft.Win32.OpenFileDialog.Multiselect" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>set: System.Security.SecurityCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets an option indicating whether <see cref="T:Microsoft.Win32.OpenFileDialog" /> allows users to select multiple files.</summary>
<value>
<see langword="true" /> if multiple selections are allowed; otherwise, <see langword="false" />. The default is <see langword="false" />.</value>
<remarks>To be added.</remarks>
<permission cref="T:System.Security.Permissions.FileIOPermission">to change the dialog user interface behavior. Associated enumeration: <see cref="F:System.Security.Permissions.PermissionState.Unrestricted" /></permission>
</Docs>
</Member>
<Member MemberName="OpenFile">
<MemberSignature Language="C#" Value="public System.IO.Stream OpenFile ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance class System.IO.Stream OpenFile() cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Win32.OpenFileDialog.OpenFile" />
<MemberSignature Language="VB.NET" Value="Public Function OpenFile () As Stream" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; System::IO::Stream ^ OpenFile();" />
<MemberSignature Language="F#" Value="member this.OpenFile : unit -&gt; System.IO.Stream" Usage="openFileDialog.OpenFile " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Security.SecurityCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.IO.Stream</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Opens a read-only stream for the file that is selected by the user using <see cref="T:Microsoft.Win32.OpenFileDialog" />.</summary>
<returns>A new <see cref="T:System.IO.Stream" /> that contains the selected file.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The file is opened with read-only permission (<xref:System.IO.FileMode.Open>, <xref:System.IO.FileAccess.Read>, and <xref:System.IO.FileShare.Read>), whether or not the Read Only checkbox is checked in the dialog. Because the file is opened without the ability to overwrite or write to the file, an application can safely load a file while executing within partial trust restrictions.
If more than one file is selected, the first selected file is opened.
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">No files were selected in the dialog.</exception>
<permission cref="T:System.Security.Permissions.FileDialogPermission">to create a file stream. Associated enumeration: <see cref="F:System.Security.Permissions.FileDialogPermissionAccess.Open" /></permission>
<altmember cref="P:Microsoft.Win32.FileDialog.SafeFileName" />
</Docs>
</Member>
<Member MemberName="OpenFiles">
<MemberSignature Language="C#" Value="public System.IO.Stream[] OpenFiles ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance class System.IO.Stream[] OpenFiles() cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Win32.OpenFileDialog.OpenFiles" />
<MemberSignature Language="VB.NET" Value="Public Function OpenFiles () As Stream()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; cli::array &lt;System::IO::Stream ^&gt; ^ OpenFiles();" />
<MemberSignature Language="F#" Value="member this.OpenFiles : unit -&gt; System.IO.Stream[]" Usage="openFileDialog.OpenFiles " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Security.SecurityCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.IO.Stream[]</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Creates an array that contains one read-only stream for each file selected by the user using <see cref="T:Microsoft.Win32.OpenFileDialog" />.</summary>
<returns>An array of multiple new <see cref="T:System.IO.Stream" /> objects that contain the selected files.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Each file is opened with read-only permission (<xref:System.IO.FileMode.Open>, <xref:System.IO.FileAccess.Read>, and <xref:System.IO.FileShare.Read>), whether or not the Read Only checkbox is checked in the dialog. Because each file is opened without the ability to overwrite or write to the file, an application can safely load one or more files while executing within partial trust restrictions.
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">No files were selected in the dialog.</exception>
<permission cref="T:System.Security.Permissions.FileDialogPermission">to create a file stream array. Associated enumeration: <see cref="F:System.Security.Permissions.FileDialogPermissionAccess.Open" /></permission>
</Docs>
</Member>
<Member MemberName="ReadOnlyChecked">
<MemberSignature Language="C#" Value="public bool ReadOnlyChecked { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool ReadOnlyChecked" />
<MemberSignature Language="DocId" Value="P:Microsoft.Win32.OpenFileDialog.ReadOnlyChecked" />
<MemberSignature Language="VB.NET" Value="Public Property ReadOnlyChecked As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property bool ReadOnlyChecked { bool get(); void set(bool value); };" />
<MemberSignature Language="F#" Value="member this.ReadOnlyChecked : bool with get, set" Usage="Microsoft.Win32.OpenFileDialog.ReadOnlyChecked" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>set: System.Security.SecurityCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets a value indicating whether the read-only check box displayed by <see cref="T:Microsoft.Win32.OpenFileDialog" /> is selected.</summary>
<value>
<see langword="true" /> if the checkbox is selected; otherwise, <see langword="false" />. The default is <see langword="false" />.</value>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="Reset">
<MemberSignature Language="C#" Value="public override void Reset ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance void Reset() cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Win32.OpenFileDialog.Reset" />
<MemberSignature Language="VB.NET" Value="Public Overrides Sub Reset ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; override void Reset();" />
<MemberSignature Language="F#" Value="override this.Reset : unit -&gt; unit" Usage="openFileDialog.Reset " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Security.SecurityCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Resets all <see cref="T:Microsoft.Win32.OpenFileDialog" /> properties to their default values.</summary>
<remarks>To be added.</remarks>
<permission cref="T:System.Security.Permissions.FileIOPermission">to reset the dialog. Associated enumeration:<see cref="F:System.Security.Permissions.PermissionState.Unrestricted" /></permission>
<block subset="none" type="overrides">
<para>This class is sealed, so you cannot override this method.</para>
</block>
</Docs>
</Member>
<Member MemberName="ShowReadOnly">
<MemberSignature Language="C#" Value="public bool ShowReadOnly { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool ShowReadOnly" />
<MemberSignature Language="DocId" Value="P:Microsoft.Win32.OpenFileDialog.ShowReadOnly" />
<MemberSignature Language="VB.NET" Value="Public Property ShowReadOnly As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property bool ShowReadOnly { bool get(); void set(bool value); };" />
<MemberSignature Language="F#" Value="member this.ShowReadOnly : bool with get, set" Usage="Microsoft.Win32.OpenFileDialog.ShowReadOnly" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>set: System.Security.SecurityCritical</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets a value indicating whether <see cref="T:Microsoft.Win32.OpenFileDialog" /> contains a read-only check box.</summary>
<value>
<see langword="true" /> if the checkbox is displayed; otherwise, <see langword="false" />. The default is <see langword="false" />.</value>
<remarks>To be added.</remarks>
</Docs>
</Member>
</Members>
</Type>
You can’t perform that action at this time.