24

I just started with WPF. Moved from Window Form.

Where do those openDialog, saveDialog gone? And a bunch of stuff.

1

1 Answer 1

27

Look in Microsoft.Win32 namespace

OpenFileDialog openDialog = new OpenFileDialog(); if (openDialog.ShowDialog().Value) { .......... } 

And the same for SaveFileDialog

SaveFileDialog saveDialog = new SaveFileDialog(); if (saveDialog.ShowDialog().Value) { .......... } 
Sign up to request clarification or add additional context in comments.

3 Comments

These are hard to set up, in the old Window Form there is easy options, anyway thanks.
Are you sure that the openDialog or the saveDialog always return a value? Otherwise you'll get a NullReferenceException.
At firs OpenFileDialog should return instance or fail with exception, it is not good practice to check null in this case because you will lost info about exception

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.