DialogResult in WPF Application in C#

I am currently developinf an application in C# using WPF, I have always only used WF. Normally if I want to ask the user a question instead of making my own dialogue I use

DialogResult result = MessageBox.show("My Message Question", "My Title", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

This is the first time that I have used a WPF form and DialogResult does not seem to be available. What do I use to get the same effect.

Thanks for your help.

Answers


Here is how you do the same in WPF:

MessageBoxResult result = MessageBox.Show("My Message Question", "My Title", MessageBoxButton.YesNo, MessageBoxImage.Question);
if (result == MessageBoxResult.Yes)
{
    // Do this
}

Need Your Help

ASP.NET MVC: Custom Validation by DataAnnotation

c# asp.net-mvc asp.net-mvc-3 data-annotations

I have a Model with 4 properties which are of type string. I know you can validate the length of a single property by using the StringLength annotation. However I want to validate the length of the 4

C# ADO.Net to db2 iseries - connection not valid

c# sql ado.net db2400

I'm having problems connecting to a DB2 iSeries database from a C# ADO.Net program.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.