2017-01-11 20 views
0

Я пытаюсь закодировать диалог Open/Save File в моем проекте WPF на .NET4.5.2. Я нашел решения на основе Win32.OpenFileDialog.Не удается найти сборку Win32 для OpenfileDialog в WPF Framework 4.5.2

Я использую Win8.1 (x64), и я не могу найти запись Win32 в сборках моего сообщества Visual Studio 2015.

Есть ли место, где я мог бы скачать архив? Как я могу сделать, чтобы управлять Open/Save Dialog другим способом?

+1

документация говорит вам, где он живет: https://msdn.microsoft.com/en-us/library/microsoft.win32.openfiledialog(v=vs.110).aspx –

ответ

0

Вы должны добавить ссылку в вашем проекте на PresentationFramework.dll

Тогда вы можете просто использовать:

private Microsoft.Win32.SaveFileDialog saveDialog = new SaveFileDialog(); 
0

Я считаю, что в PresentationFramework сборки:

namespace Microsoft.Win32 
{ 
// 
// Summary: 
//  Represents a common dialog box that allows a user to specify a filename for one 
//  or more files to open. 
public sealed class OpenFileDialog : FileDialog 
{ 
    // 
    // Summary: 
    //  Initializes a new instance of the Microsoft.Win32.OpenFileDialog class. 
    [SecurityCritical] 
    public OpenFileDialog(); 

    // 
    // Summary: 
    //  Gets or sets an option indicating whether Microsoft.Win32.OpenFileDialog allows 
    //  users to select multiple files. 
    // 
    // Returns: 
    //  true if multiple selections are allowed; otherwise, false. The default is false. 
    public bool Multiselect { get; set; } 
    // 
    // Summary: 
    //  Gets or sets a value indicating whether the read-only check box displayed by 
    //  Microsoft.Win32.OpenFileDialog is selected. 
    // 
    // Returns: 
    //  true if the checkbox is selected; otherwise, false. The default is false. 
    public bool ReadOnlyChecked { get; set; } 
    // 
    // Summary: 
    //  Gets or sets a value indicating whether Microsoft.Win32.OpenFileDialog contains 
    //  a read-only check box. 
    // 
    // Returns: 
    //  true if the checkbox is displayed; otherwise, false. The default is false. 
    public bool ShowReadOnly { get; set; } 

    // 
    // Summary: 
    //  Opens a read-only stream for the file that is selected by the user using Microsoft.Win32.OpenFileDialog. 
    // 
    // Returns: 
    //  A new System.IO.Stream that contains the selected file. 
    // 
    // Exceptions: 
    // T:System.InvalidOperationException: 
    //  No files were selected in the dialog. 
    [SecurityCritical] 
    public Stream OpenFile(); 
    // 
    // Summary: 
    //  Creates an array that contains one read-only stream for each file selected by 
    //  the user using Microsoft.Win32.OpenFileDialog. 
    // 
    // Returns: 
    //  An array of multiple new System.IO.Stream objects that contain the selected files. 
    // 
    // Exceptions: 
    // T:System.InvalidOperationException: 
    //  No files were selected in the dialog. 
    [SecurityCritical] 
    public Stream[] OpenFiles(); 
    // 
    // Summary: 
    //  Resets all Microsoft.Win32.OpenFileDialog properties to their default values. 
    [SecurityCritical] 
    public override void Reset(); 
    [SecurityCritical] 
    [SecurityTreatAsSafe] 
    protected override void CheckPermissionsToShowDialog(); 
} 
} 

Если вам нужен лучший диалог для каталога выбора, вам нужен пакет Microsoft.WindowsAPICodePack NuGet:

using Microsoft.WindowsAPICodePack.Dialogs; 
using System.IO; 
// .... 
     var browserDialog = new CommonOpenFileDialog(); 
     browserDialog.IsFolderPicker = true; 
     browserDialog.Title = Title; 
// --- 
+0

В настоящее время, я дон Не нужны какие-либо дополнительные функции. я держу свой пост в стеке Спасибо – Xavier123456789

 Смежные вопросы

  • Нет связанных вопросов^_^