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.
I need to display a modeless dialog in WPF, in an application which uses the MVVM pattern. Is there an example where this is demonstrated, starting with opening the dialog, and ending with closing this dialog.
I have tried, but that modeless dialog does not close even after the application is closed. I would like to close the modeless dialog when the application is closed.
What I have tried is this: From the ViewModel, tried to open the dialog. But this is bad MVVM practice, since the ViewModel should ideally not know anything about the views. So, my question is where exactly should I create the modeless dialog, and how to control its lifecycle? Pointers to any example Visual Studio solution workspaces are most welcome.
Visual Studio 2019 --- Windows Forms App (.NET Framework) C# ... Toolbox => Data => Charts provides the ability to create xy plots.
This does not exist in WPF APP (.NET Framework).
I've found multiple sites that demo a variety of shapes using .xaml and .cs. But none that demo a combo of both for an xy plot (not predefined shapes), where the .xaml defines the location and the .cs provides the data.
How do I create xy plots with WPF APP (.NET Framework)?
privatevoid Containers_OnTargetUpdated(object? sender, DataTransferEventArgs e)
var current = sender as DependencyObject;
var scroller = current as ScrollViewer;
while (scroller == null && current != null)
current = VisualTreeHelper.GetParent(current);
scroller = current as ScrollViewer;
if (scroller != null)
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
I always had the properties declared in the VM, loaded from the model which reflect a view from the database. However I have a tool that generates the code from the database to the model and a region in the VM so refactoring effort is minimal.
Never underestimate the power of human stupidity -
I'm old. I know stuff - JSOP
The first approach is really a "cheating" MVVM approach. You might as well not bother having the VM in there at this point because your view is almost binding directly to the model with only the thinnest of abstractions sitting on top. One of the purposes of the VM is that it is there to act as a guard for your model; suppose that I have a requirement that a model can only be saved if field_A is set and then field_B contains a value from 0 to 10, but if field_A isn't set then field_B can accept anything from 0 to 30. The VM is the place to ensure that this guardrail is enabled; it ensures the model is always pure before you attempt to save it.