Return user click

4 posts, 0 answers
  1. Dongzhi
    Dongzhi avatar
    25 posts
    Member since:
    Jan 2014

    Posted 23 Oct 2014 Link to this post

    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;
            }

  2. Nasko
    Admin
    Nasko avatar
    586 posts

    Posted 24 Oct 2014 Link to this post

    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.

     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Dongzhi
    Dongzhi avatar
    25 posts
    Member since:
    Jan 2014

    Posted 27 Oct 2014 in reply to Nasko Link to this post

    What would be the best approach to do that? 
  5. Nasko
    Admin
    Nasko avatar
    586 posts

    Posted 27 Oct 2014 Link to this post

    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.

     
Back to Top