RadConfirm with Checkbox

3 posts, 0 answers
  1. Rory
    Rory avatar
    159 posts
    Member since:
    Jul 2007

    Posted 03 Oct 2012 Link to this post

    Hi how can I add a Checkbox to the RadConfirm control? For example a standard "Do not show again" checkbox.
  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 08 Oct 2012 Link to this post

    Hello Rory,

    You should modify the template of RadConfirm in order to add a checkbox. Please check the following links for more details about this:
    Styling the Predefined Windows
    Styling the RadWindow

    Regards,
    Yana
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
  4. Rory
    Rory avatar
    159 posts
    Member since:
    Jul 2007

    Posted 08 Oct 2012 Link to this post

    Hi Yana,
    I unfortunately don't have the Expression Suite so I went with a different approach than editing the existing template. I built a custom Silverlight Control with all the buttons and checkboxes that I wanted and then I called my control as the content of a RadWindow. This allowed me to use my own content for the RadWindow while leveraging the radwindow styles. I'll paste the code below.

    Thanks.


    custom control ConfirmWindow.XAML
    <UserControl x:Class="Systema.Sims.Dashboard.Controls.ConfirmWindow"
        mc:Ignorable="d"
        d:DesignHeight="70" d:DesignWidth="358" HorizontalAlignment="Center" VerticalAlignment="Center">
        <Grid x:Name="LayoutRoot" Background="White" Height="78" Width="430">
            <StackPanel VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="5,5,5,5" >
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition></RowDefinition>
                        <RowDefinition></RowDefinition>
                        <RowDefinition></RowDefinition>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="100"/>
                        <ColumnDefinition Width="50" />
                        <ColumnDefinition Width="81"/>
                        <ColumnDefinition Width="81" />
                    </Grid.ColumnDefinitions>
                    <TextBlock x:Name="txtConfirm" Grid.Row="0" Grid.ColumnSpan="4" Text="Transfer the selected claims?" Height="22" FontSize="12" />
     
                    <TextBlock Grid.Column="0" Grid.Row="1"  Text="Include Diaries?" FontSize="12" />
                    <CheckBox Grid.Column="1" Grid.Row="1"  x:Name="chkIncludeDiaries" Margin="6,0,16,0"></CheckBox>
                    <Button Grid.Column="2" Grid.Row="1"  Click="btnConfirmOk_Click" Content="Ok" />
                    <Button Grid.Column="4" Grid.Row="1"  Click="btnConfirmCancel_Click" Content="Cancel" />
                </Grid>
            </StackPanel>
        </Grid>
    </UserControl>

     
    ConfirmWindow.Xaml.CS

    namespace Systema.Sims.Dashboard.Controls
    {
        public partial class ConfirmWindow : UserControl
        {
            public static RoutedEventHandler ConfirmOk;
            public static RoutedEventHandler ConfirmCancel;
     
            public ConfirmWindow()
            {
                InitializeComponent();
            }
     
            public void SetText(string text)
            {
                txtConfirm.Text = text;
            }
     
            private void btnConfirmOk_Click(object sender, RoutedEventArgs e)
            {
                ConfirmOk(chkIncludeDiaries, e);
            }
     
            private void btnConfirmCancel_Click(object sender, RoutedEventArgs e)
            {
                ConfirmCancel(chkIncludeDiaries, e);
            }
        }
    }

     



    MainPage.XAML.CS

    public RadWindow confirmWindow;
     
    public MainPage()
    {
       ConfirmWindow.ConfirmOk += new RoutedEventHandler(ConfirmOk);
       ConfirmWindow.ConfirmCancel += new RoutedEventHandler(ConfirmCancel);
    }
     
    OpenWindow()
    {
       ConfirmWindow ctw = new ConfirmWindow();
        ctw.SetText("Transfer the selected items to " + destinedUser);
        confirmWindow = new RadWindow();
        confirmWindow.Header = "Confirm Transfer";
        confirmWindow.Content = ctw;
        confirmWindow.ResizeMode = ResizeMode.NoResize;
        confirmWindow.CanMove = false;
        confirmWindow.WindowStartupLocation = Telerik.Windows.Controls.WindowStartupLocation.CenterOwner;
        confirmWindow.ShowDialog();
    }
     
    private void ConfirmCancel(object sender, RoutedEventArgs e)
    {
        confirmWindow.Close();   
    }
    private void ConfirmOk(object sender, RoutedEventArgs e)
    {
     //do a bunch of stuff
    }
Back to Top