Repository navigation
Expand file tree
/
Copy pathOpenFileDialog.xml
More file actions
276 lines (262 loc) · 15 KB
/
Copy pathOpenFileDialog.xml
File metadata and controls
276 lines (262 loc) · 15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
<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
Inherits FileDialog" />
<TypeSignature Language="C++ CLI" Value="public ref class OpenFileDialog sealed : Microsoft::Win32::FileDialog" />
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<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"><].

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:
 OpenFileDialog();" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<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:
 override void CheckPermissionsToShowDialog();" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.Security.SecurityCritical</AttributeName>
</Attribute>
<Attribute>
<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:
 property bool Multiselect { bool get(); void set(bool value); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<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:
 System::IO::Stream ^ OpenFile();" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<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:
 cli::array <System::IO::Stream ^> ^ OpenFiles();" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<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:
 property bool ReadOnlyChecked { bool get(); void set(bool value); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<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:
 override void Reset();" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<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:
 property bool ShowReadOnly { bool get(); void set(bool value); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>PresentationFramework</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<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>