Click here to Skip to main content
15,893,487 members
Articles / Desktop Programming / WPF

Extend OpenFileDialog and SaveFileDialog Using WPF

Rate me:
Please Sign up or sign in to vote.
4.90/5 (23 votes)
16 Jun 2015CPOL9 min read 188.9K   6.3K   71  
Customize OpenFileDialog and SaveFileDialog using a WPF Window
' Copyright © Decebal Mihailescu 2010
' Some code was obtained by reverse engineering the PresentationFramework.dll using Reflector

' All rights reserved.
' This code is released under The Code Project Open License (CPOL) 1.02
' The full licensing terms are available at http://www.codeproject.com/info/cpol10.aspx
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
' KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
' IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
' PURPOSE. IT CAN BE DISTRIBUTED FREE OF CHARGE AS LONG AS THIS HEADER 
' REMAINS UNCHANGED.

Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Windows.Interop
Imports System.ComponentModel

Namespace WpfCustomFileDialog
    Public Interface IFileDlgExt
        Inherits IWin32Window
        Event EventFileNameChanged As PathChangedEventHandler
        Event EventFolderNameChanged As PathChangedEventHandler
        Event EventFilterChanged As FilterChangedEventHandler
        Property FileDlgStartLocation() As AddonWindowLocation
        Property FileDlgOkCaption() As String
        Property FileDlgEnableOkBtn() As Boolean
        WriteOnly Property FixedSize() As Boolean
        Property FileDlgDefaultViewMode() As NativeMethods.FolderViewMode
    End Interface
    'consider http://geekswithblogs.net/lbugnion/archive/2007/03/02/107747.aspx instead
    Public Interface IWindowExt

        WriteOnly Property Source() As HwndSource
        WriteOnly Property ParentDlg() As IFileDlgExt
    End Interface
End Namespace

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United States United States
Decebal Mihailescu is a software engineer with interest in .Net, C# and C++.

Comments and Discussions