views:

119

answers:

1

In WinForms we could specify DialogResult for buttons. In WPF we can declare in XAML only Cancel button:

<Button Content="Cancel" IsCancel="True" />

For others we need to catch ButtonClick and write code like that:

private void Button_Click(object sender, RoutedEventArgs e)
{
    this.DialogResult = true;
}

I am using MVVM, so I have only XAML code for windows. But for modal windows I need to write such code and I don't like this. Is there a more elegant way to do such things in WPF?

+1  A: 

An alternative way is to use Popup Control

Try this tutorial.

xscape