Yes, no, cancellation confirmation in Silverlight

I need to have yes No Cancel the confirmation window in my silverlight application. I am trying to use a child window for this purpose. But it this.Show();does not wait until the user gives his input.

Any help?

thank

PS: i m new for silverlight

+3
source share
6 answers

Use the child form, because currently you are simply reordering the code in which it is called Show: -

void SomeMethod()
{
   var dialog = new YesNoCancelDialog();
   dialog.Closed += (s, args) =>
   {
     switch (dialog.Result)
     {
        //Handle resulting user choice
     }
   }
   dialog.Show();
}
+5
source

If you’ll be fine with the OK and Cancel buttons, you can also use Messagebox, although it doesn’t look so fantastic.

MessageBoxResult result = MessageBox.Show("Lorem ipsum doso mitus dasam ...", 
    "The title", MessageBoxButton.OKCancel);

if (result == MessageBoxResult.OK) {
    MessageBox.Show("You clicked OK");
}
+16
source
+1

, , , Google , , , :)

0

If you are using System.Windows.MessageBox, make sure you call .Show () on the user interface thread. Also, evaluate the MessageBox.Show arguments before passing the BeginInvoke closure to avoid insecure access flows.

var message = MyUnsafeObjectAccess.Foobar;
Deployment.Current.Dispatcher.BeginInvoke(() => MessageBox.Show(message)); // safe
0
source

Source: https://habr.com/ru/post/1743815/


All Articles