Search code examples
c#.netwpfrequestresponse

I have a image saved in data base how can I open this image with a op and save as dialog box


C# WPF Application : I have a image saved in my database that i am reading as a byte stream this part is done My Question is How can I open this image with a open/save as dialog box. Like the one that appears in web browsers.

For Example In Dialog Box if the User Click Open word, pdf or image file should directly open otherwise if he clicks on save as it should open a Save as Dialog Box..

Please support...

This is the Dialog that i want to appear in my application First Image on the link


Solution

  • use the save file dialog in the Microsoft.Win32 namespace

    http://msdn.microsoft.com/en-us/library/microsoft.win32.savefiledialog(v=vs.110).aspx

    when the save is pressed, you get the result for it. (ShowDialog() actually) and when it is OK/yes then proceed to save the image read from the DB to the path and filename the user selected

    take a look at this too:

    http://www.wpf-tutorial.com/dialogs/the-savefiledialog/

    I am also unsure but I think you can still use the System.Windows.Forms SaveFileDialog too but will make your app a little bloated as you need the System.Windows.Forms assembly in order to access it.