Tri-State RadConfirm

8 posts, 0 answers
  1. Seb Doe
    Seb Doe avatar
    3 posts
    Member since:
    May 2010

    Posted 27 May 2010 Link to this post

    Hello,
    I would like to know if there is a simple way to have a RadConfirm window with three buttons like Yes, No and Cancel.

    Thank you for advance.
  2. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 01 Jun 2010 Link to this post

    Hi Seb,

     The RadConfirm doesn't support this feature. You could inherit from the RadWindow control in XAML (like you do with the UserControl class) and make it act like a three state confirm dialog and add it a static method Confirm with the appropriate parameters and use it.

    Hope this helps.

    Greetings,
    Miroslav Nedyalkov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Seb Doe
    Seb Doe avatar
    3 posts
    Member since:
    May 2010

    Posted 01 Jun 2010 Link to this post

    Thanks for the reply. This is the solution I would like to avoid.
    I purpose to you this approach:
    When the window is opened, I inject the third button with the specified content. If the user clicks on the button, it is closing the window with a dialog result as Null.

                var parameters = new DialogParameters(); 
                parameters.Opened += (sender, args) =>  
                { 
                    var dialog = (RadWindow)sender; 
                    var panel = (Panel)((ContentControl)dialog.Content).Template.FindName("DialogButtons", (ContentControl)dialog.Content); 
                    if (panel == null || panel.Children.Count < 1
                        return; 
                    var first = panel.Children[0] as RadButton; 
                    if (first == null) 
                        return; 
     
                    var newButton = first.CloneShallow(); 
                    newButton.Content = thirdButtonContent
     
                    newButton.Click += (sender2, args2) => 
                    { 
                        dialog.Close(); 
                    }; 
     
                    panel.Children.Add(newButton); 
                }; 

    I hope it could help others.
  5. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 03 Jun 2010 Link to this post

    Hi Seb,

     Thank you for sharing your solution! I suggested you the other approach, because the preferred way of adding visual elements (like buttons) is using XAML and not using C# code for it. Anyway the suggested approach looks fine.

    Regards,
    Miroslav Nedyalkov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  6. Alfredo
    Alfredo avatar
    4 posts
    Member since:
    Oct 2010

    Posted 29 Aug 2011 Link to this post

    I am sorry but this event not fire on Version 2011 2 0712 in previous version it was ok
  7. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 30 Aug 2011 Link to this post

    Hi Alfredo,

     The Opened event is not supported anymore. We apologize for the inconvenience caused. My suggestion is to use the Style property of the Dialog parameters to change the look of the dialog and add another button. For more information on how to do this you could refer to this help article. To add a Close button just a RadButton with its Command property set to telerik:WindowCommands.Close.

    Hope this helps.

    Kind regards,
    Miroslav Nedyalkov
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  8. Alfredo
    Alfredo avatar
    4 posts
    Member since:
    Oct 2010

    Posted 31 Aug 2011 Link to this post

    I used this code to Set Focus in cancel button.

    RadWindow.Confirm(
                        new DialogParameters()
                        {
                            Closed = (s, closedEvent) =>
                            {
                                // something here
                            },
                            Opened = (s, openedEvent) =>
                            {
                                RadWindow confirm = s as RadWindow;
                                Button Cancel = confirm.ChildrenOfType<Button>()[5];
                                FocusManager.SetIsFocusScope(confirm, true);
                                FocusManager.SetFocusedElement(confirm, Cancel);
                            },
                            Content = "Delete ?",
                            Header = "Confirm",
                            Owner = this
                        });

    What should i do if i can not use this event ?
  9. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 01 Sep 2011 Link to this post

    Hi Alfredo,

    You could create an attached property which when set is hooking to the Loaded event of the Window. When the Loaded event fires it focuses the button. After that you should change the template and set it to the button.

    Hope this information helps.

    Kind regards,

    Konstantina
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Back to Top
UI for WPF is Visual Studio 2017 Ready