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

Return user click

3 Answers 111 Views
Window
This is a migrated thread and some comments may be shown as answers.
Dongzhi
Top achievements
Rank 1
Dongzhi asked on 23 Oct 2014, 05:21 PM
I created user control of the RadWindow with custom content and controls. The issue I'm having is when I show the dialog it can't get a way to return what the button the user returns. What occurs is as soon as the dialog shows up it always returns the default button without waiting for the dialog to close.

button click event for buttons:

private void Clicked(object sender, ExecutedRoutedEventArgs e)
        {
            ButtonType dr = (ButtonType)Enum.Parse(typeof(ButtonType), e.Parameter.ToString());
            this.DialogResponse = dr;

            dialogWindow.Close();
        }

common function on page:
public ButtonType ShowMessageDialog(string message, string caption, DialogButtonSet buttons, DialogIcon icon)
        {
            this.Style = null;
            this.DialogText = message;
            this.DialogButtonType = buttons;
            this.HeaderImageIcon = icon;
            this.DialogTitle = caption;
            this.ButtonClickPreview = null;
            this.MessageBox.Visibility = Visibility.Visible;
            this.CustomContent.Visibility = Visibility.Collapsed;
            this.Launched = true;
            this.ClearPushdown();
            this.ShowDialog();                     <===== I want the code to stop here until window closes
            return this.DialogResponse;
        }

3 Answers, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 24 Oct 2014, 04:28 PM
Hello Dongzhi,

We suggest you to handle the Closed event of your RadWindow based UserControl - thus as soon as the window is closed that event will fire and you should be able to get the latest value of the desired property in the handler. Please give it a try and let us know if it worked for you.

I hope this will help you.

Regards,
Nasko
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Dongzhi
Top achievements
Rank 1
answered on 27 Oct 2014, 02:48 PM
What would be the best approach to do that? 
0
Nasko
Telerik team
answered on 27 Oct 2014, 04:46 PM
Hi Dongzhi,

I am sending you a sample project that demonstrates the proposed solution from my previous response. Please see the attached zip. 

Hope this will help you to achieve the desired.

Regards,
Nasko
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Window
Asked by
Dongzhi
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Dongzhi
Top achievements
Rank 1
Share this question
or