Different action for RadWindow.Confirm buttons

2 posts, 0 answers
  1. Alexandre
    Alexandre avatar
    8 posts
    Member since:
    May 2018

    Posted 18 May 2018 Link to this post

    Hi, I'm using a RadWindow.Confirm with OK and Cancel buttons, but I need that when I click on button OK call a different function than Cancel.

    Example:

            private void OnOK(object sender, WindowClosedEventArgs e)
            {
               // Call it when clicked on button OK
            }

            private void OnCancel(object sender, WindowClosedEventArgs e)
            {
               // Call it when clicked on button Cancel
            }

     

    Thks!

  2. Dinko
    Admin
    Dinko avatar
    889 posts

    Posted 23 May 2018 Link to this post

    Hello Alexandre,

    The RadWindow.Confirm() doesn't provide events for the buttons. Basically, to check which button is pressed you can subscribe to the Closed event and check the bool? DialogResult property from the event arguments. It will be True when the user presses the OK button.
    public void ShowConfirm()
    {
        RadWindow.Confirm("Are you sure?", this.OnClosed);
    }
    private void OnCancel(object sender, WindowClosedEventArgs e)
    {
        if (e.DialogResult == true)
        {
            // your code
        }
    }

    Regards,
    Dinko
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top