This is a migrated thread and some comments may be shown as answers.

Different action for RadWindow.Confirm buttons

1 Answer 238 Views
Window
This is a migrated thread and some comments may be shown as answers.
Alexandre
Top achievements
Rank 1
Alexandre asked on 18 May 2018, 04:36 PM

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!

1 Answer, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 23 May 2018, 11:04 AM
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.
Tags
Window
Asked by
Alexandre
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or