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

RadConfirm with Checkbox

2 Answers 22 Views
Window
This is a migrated thread and some comments may be shown as answers.
Rory
Top achievements
Rank 1
Rory asked on 03 Oct 2012, 08:29 PM
Hi how can I add a Checkbox to the RadConfirm control? For example a standard "Do not show again" checkbox.

2 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 08 Oct 2012, 08:13 AM
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.

0
Rory
Top achievements
Rank 1
answered on 08 Oct 2012, 04:00 PM
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
}
Tags
Window
Asked by
Rory
Top achievements
Rank 1
Answers by
Yana
Telerik team
Rory
Top achievements
Rank 1
Share this question
or