For those new to message boards please try to follow a few simple rules when posting your question.
Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
Keep the subject line brief, but descriptive. eg "File Serialization problem"
Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode "<" (and other HTML) characters when pasting" checkbox before pasting anything inside the PRE block, and make sure "Use HTML in this post" check box is checked.
Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
Please do not post links to your question into an unrelated forum such as the lounge. It will be deleted. Likewise, do not post the same question in more than one forum.
Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
No advertising or soliciting.
We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
My problem is very difficult to describe but this is what I am trying to do. See all code below. What I have is a parent WPF Window that has a child View, created as a UserControl, added to the parent Window in it's markup. Now the problem is this. When a row, on the child UserControl View's GridView is clicked I want to close the child view's parent (Window) then navigate to an entirely new Window and open it. When I click the row I get the error 'Invalid cast exception". See below:
I'm new to WPF/MVVM and have been trying to come up with a solution for communicating between ViewModels. The best i've been able to come up with is below, it works, but it feels dirty and shameful. Any suggestions would be greatly appreciated.
I am struggling with the decision how to design my application. Let me describe my problem:
The application has a navigation on the left and the region to display the according view to the right.
It shall load projects and those projects can be of type A, B or C. The navigation is the same for all types, but some of the views differ.
My plan was for all type depending items in the navigation to have a general view which offers a region and the modules A, B and C which all provide a view for that region. During the loading of the project depending on its type the module / library A, B or C is loaded while the other library is unloaded. But I found out it is not supported to unload modules (only complete AppDomains).
I am developing in C# using VS 2010 and Prism 4.0.
Anyone has an idea how to best solve this issue? Is creating and unloading a temporary AppDomain really the best solution?
Glad that's working for you; sometimes the simplest solution is the best one.
If a better solution comes to mind later (as it often does), you have the option to go back and re-factor if it makes a difference. That's typical of software; when that gnawing feeling stops, you know you are "optimal".
I have a logon DLL that has a form which needs to be displayed in the main applications main windows navigation Frame. There is no mucking about with app domains but it is a PITA to put it together. App.xaml - get the arguments passed into the start up exe and pass them to the main window VM.
MainVM has a reference to the main view (I know breaks the MVVM model) and the logon DLL. It gets the URL for the logon view from the DLL code>@"pack://application:,,,/LogonDLLName;component/Views/Logon.xaml and puts it into the frame in the main window.
It subscribes to the LoadCompleted method of the view to get the datacontext of the Logon view. And the PropertyChanged event in the Logon DLL VM.
PropertyChanged gets the content from the logon event and proceeds with the application.
As I said this is a PITA but it does work and we can relatively easily use the same logon DLL for all the applications. I hesitate to put this out there as I'm bloody certain there is a better way to do it.
Never underestimate the power of human stupidity
What occurs to me is that you can solve this using a combination of this article[^] with some clever work with the AppResources to register your views with "on-demand", replacing view references as necessary.
I have searched the internet and can't find an answer to my question. In one of my WPF XMAL pages which is a Views I am using a GridView to load and binding values for each DisplayMemberBinding row. What I need to do is raise a row selected event but the GridView does not contain that event. How do I create a row selected event for the WPF GridView?