Click here to Skip to main content
15,746,302 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to open a new window after I select a file from ShowDialog. I am doing it in MVVM pattern

there is a xaml file exist in

What I have tried:

               Nullable<bool> result = openFileDlg.ShowDialog();

               if (result == true)
                   var test = new MVVMFileMange.View.UI.SourceFolder1();
Updated 7-Jan-21 2:45am
john321a 7-Jan-21 5:43am    
here,result = true

but got exception at var test = new MVVMFileMange.View.UI.SourceFolder1();

Use the debugger and see exactly what your dialog is returning - the chances are that it isn't returning true as a result of an OK keypress so your code doesn't get to pass the test and display a second dialog.
Alternatively, it could be the SourceFolder1 constructor is throwing an exception.

Either way, you need your complete code running to work out exactly what is happening, and that means using the debugger. We can't do that for you - we don't have access to the rest of your code!
Share this answer
john321a 7-Jan-21 5:35am    
test in var test = new MVVMFileMange.View.SourceFolder1() is null
OriginalGriff 7-Jan-21 5:50am    
So now you need to use the debugger to step into the constructor and find out why.

We can't do that for you!
john321a 7-Jan-21 6:11am    
it hit on the constructor.but window not shown
OriginalGriff 7-Jan-21 6:46am    
So "use the debugger to step into the constructor and find out why."

Seriously, I can't do that for you - I can't even *see* the constructor, much less execute it under the same conditions you do ...
john321a 7-Jan-21 7:08am    
public partial class SourceFolder : Window
public SourceFolder()

it hit on public SourceFolder() and comes out from here. so the value of the text is "null"
problem is
getting a callback to a UI component from a background thread

solved by adding below code
      // your code
Share this answer

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900