<?xml version="1.0" encoding="utf-8"?>
<UserControl x:Class="CustomDialogs.EditRecurrenceControl" Loaded="UserControl_Loaded" x:Name="root" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:c1="http://schemas.componentone.com/winfx/2006/xaml">
	<UserControl.Resources>
        <SolidColorBrush x:Key="BorderBrush" Color="#3F000000" />
        <c1:C1_Schedule_EditRecurrence x:Key="C1_Schedule_EditRecurrence" />
	</UserControl.Resources>
    <Grid x:Name="LayoutRoot" Margin="5">
        <Grid.Resources>
            <c1:EnsureEnumMemberConverter x:Key="EnsureEnumMemberConverter" />
            <c1:WeekOfMonthEnumToStringConverter x:Key="WeekOfMonthEnumToStringConverter" />
            <c1:WeekDaysEnumToStringConverter x:Key="WeekDaysEnumToStringConverter" />
            <c1:WeekDaysToIntConverter x:Key="WeekDaysToIntConverter" />
            <c1:SelectedEnumMemberConverter x:Key="SelectedEnumMemberConverter" />
            <ControlTemplate x:Key="GroupTemplate" TargetType="c1:C1HeaderedContentControl">
                <Grid UseLayoutRounding="true">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="6" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="6" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                        <RowDefinition Height="6" />
                    </Grid.RowDefinitions>
                    <Border CornerRadius="4" Grid.Row="1" Grid.RowSpan="3" Grid.ColumnSpan="4" BorderThickness="1,0,1,1" BorderBrush="White">
                        <Border BorderThickness="1,0,1,1" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="3">
                            <Border BorderThickness="1,0,1,1" BorderBrush="White" CornerRadius="2" />
                        </Border>
                    </Border>
                    <Border CornerRadius="4,0,0,0" Grid.Row="1" Grid.Column="0" BorderThickness="0,1,0,0" BorderBrush="White">
                        <Border BorderThickness="0,1,0,0" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="3,0,0,0">
                            <Border BorderThickness="0,1,0,0" BorderBrush="White" CornerRadius="2,0,0,0" />
                        </Border>
                    </Border>
                    <Border CornerRadius="0,4,0,0" Grid.Row="1" Grid.Column="2" Grid.ColumnSpan="2" BorderThickness="0,1,0,0" BorderBrush="White">
                        <Border BorderThickness="0,1,0,0" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="0,3,0,0">
                            <Border BorderThickness="0,1,0,0" BorderBrush="White" CornerRadius="0,2,0,0" />
                        </Border>
                    </Border>
                    <Border x:Name="Header" Padding="0,1,0,0" Grid.Row="0" Grid.RowSpan="2" Grid.Column="1">
                        <TextBlock Grid.Column="0" Text="{TemplateBinding Header}" FontFamily="{TemplateBinding HeaderFontFamily}" FontSize="{TemplateBinding HeaderFontSize}" FontStretch="{TemplateBinding HeaderFontStretch}" FontStyle="{TemplateBinding HeaderFontStyle}" FontWeight="{TemplateBinding HeaderFontWeight}" Foreground="{TemplateBinding HeaderForeground}" HorizontalAlignment="{TemplateBinding HorizontalHeaderAlignment}" Padding="2" Margin="2" VerticalAlignment="{TemplateBinding VerticalHeaderAlignment}" />
                    </Border>
                    <ContentPresenter Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2" Margin="{TemplateBinding Padding}" UseLayoutRounding="{TemplateBinding UseLayoutRounding}" />
                </Grid>
            </ControlTemplate>
            <DataTemplate x:Key="WeekOfMonthComboItemTemplate">
                <TextBlock Text="{Binding Converter={StaticResource WeekOfMonthEnumToStringConverter}}" />
            </DataTemplate>
            <DataTemplate x:Key="WeekDaysComboItemTemplate">
                <TextBlock Text="{Binding Converter={StaticResource WeekDaysEnumToStringConverter}}" />
            </DataTemplate>
        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <c1:C1HeaderedContentControl x:Name="whenGroup" Template="{StaticResource GroupTemplate}" Margin="5" Padding="5" BorderThickness="1" Foreground="{Binding Foreground, ElementName=root}" HeaderForeground="{Binding Foreground, ElementName=root}" Grid.Row="0" Header="{Binding grpWhen, Source={StaticResource C1_Schedule_EditRecurrence}}">
            <ContentControl.Content>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    <StackPanel Orientation="Horizontal" Grid.Column="0" HorizontalAlignment="Left">
                        <TextBlock Margin="10,2,0,2" VerticalAlignment="Center" Text="{Binding start, Source={StaticResource C1_Schedule_EditRecurrence}}" />
                        <c1:C1DateTimePicker x:Name="startTime" TimeIncrement="00:15" EditMode="Time" IsTabStop="False" TimeFormat="ShortTime" Padding="1" Margin="10,2,0,2" VerticalAlignment="Center" DateTime="{Binding Path=StartTime, Mode=TwoWay}" />
                    </StackPanel>
                    <StackPanel Orientation="Horizontal" Grid.Column="1" HorizontalAlignment="Left">
                        <TextBlock Margin="20,2,0,2" Padding="5" VerticalAlignment="Center" Text="{Binding end, Source={StaticResource C1_Schedule_EditRecurrence}}" />
                        <c1:C1DateTimePicker x:Name="endTime" TimeIncrement="00:15" EditMode="Time" IsTabStop="False" TimeFormat="ShortTime" Padding="1" Margin="10,2,0,2" VerticalAlignment="Center" DateTimeChanged="endTime_DateTimeChanged" />
                    </StackPanel>
                    <StackPanel Orientation="Horizontal" Grid.Column="2" HorizontalAlignment="Left">
                        <TextBlock Text="{Binding duration, Source={StaticResource C1_Schedule_EditRecurrence}}" Margin="20,2,0,2" Padding="5" VerticalAlignment="Center" />
                        <c1:C1TimeEditor x:Name="duration" Increment="00:15" Format="TimeSpan" Minimum="0:00" Maximum="14.00:00" CycleChangesOnBoundaries="False" ValueChanged="duration_ValueChanged" Padding="1" Margin="10,2,0,2" VerticalAlignment="Center" />
                    </StackPanel>
                </Grid>
            </ContentControl.Content>
        </c1:C1HeaderedContentControl>
        <c1:C1HeaderedContentControl x:Name="Repeats" Grid.Row="1" Template="{StaticResource GroupTemplate}" Margin="5" Padding="5" BorderThickness="1" Foreground="{Binding Foreground, ElementName=root}" HeaderForeground="{Binding Foreground, ElementName=root}" Header="{Binding grpRepeats, Source={StaticResource C1_Schedule_EditRecurrence}}">
            <ContentControl.Content>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <Border BorderBrush="{Binding ElementName=Repeats, Path=BorderBrush}" BorderThickness="0,0,1,0" Padding="0,0,10,0">
                        <StackPanel>
                            <RadioButton x:Name="DailyGroupRB" Margin="5" Checked="DailyGroupRB_Checked" IsChecked="{Binding Path=RecurrenceType, Mode=TwoWay,            Converter={StaticResource EnsureEnumMemberConverter},            ConverterParameter=Daily;Workdays}" Content="{Binding rbDaily, Source={StaticResource C1_Schedule_EditRecurrence}}" />
                            <RadioButton x:Name="WeeklyRB" Margin="5" Checked="WeeklyRB_Checked" IsChecked="{Binding Path=RecurrenceType, Mode=TwoWay,            Converter={StaticResource EnsureEnumMemberConverter},            ConverterParameter=Weekly}" Content="{Binding rbWeekly, Source={StaticResource C1_Schedule_EditRecurrence}}" />
                            <RadioButton x:Name="MonthlyGroupRB" Margin="5" Checked="MonthlyGroupRB_Checked" IsChecked="{Binding Path=RecurrenceType, Mode=TwoWay,            Converter={StaticResource EnsureEnumMemberConverter},            ConverterParameter=Monthly;MonthlyNth}" Content="{Binding rbMonthly, Source={StaticResource C1_Schedule_EditRecurrence}}" />
                            <RadioButton x:Name="YearlyGroupRB" Margin="5" Checked="YearlyGroupRB_Checked" IsChecked="{Binding Path=RecurrenceType, Mode=TwoWay,            Converter={StaticResource EnsureEnumMemberConverter},            ConverterParameter=Yearly;YearlyNth}" Content="{Binding rbYearly, Source={StaticResource C1_Schedule_EditRecurrence}}" />
                        </StackPanel>
                    </Border>
                    <Border Name="DailyDetails" Grid.Column="1"> 
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="50*" />
                                <RowDefinition Height="50*" />
                            </Grid.RowDefinitions>
                            <StackPanel Grid.Row="0" Orientation="Horizontal">
                                <RadioButton x:Name="DailyRB" GroupName="DailyGroup" Margin="5" VerticalAlignment="Center" Checked="DailyRB_Checked" IsChecked="{Binding Path=RecurrenceType,            Converter={StaticResource SelectedEnumMemberConverter},                                              ConverterParameter=Daily}" Content="{Binding rbDailyRB, Source={StaticResource C1_Schedule_EditRecurrence}}" />
                                <c1:C1NumericBox x:Name="DailyDetails11" GotFocus="DailyDetails11_GotFocus" AllowNull="False" MaxWidth="50" MinWidth="40" Padding="2" VerticalAlignment="Center" Margin="10,2,0,2" Minimum="1" Maximum="999" Format="#" Value="{Binding Path=Interval, NotifyOnValidationError=True, Mode=TwoWay}" />
                                <TextBlock Margin="10,2,0,2" VerticalAlignment="Center" Text="{Binding txtDays, Source={StaticResource C1_Schedule_EditRecurrence}}" />
                            </StackPanel>
                            <StackPanel Grid.Row="1" Orientation="Horizontal">
                                <RadioButton x:Name="WorkdaysRB" GroupName="DailyGroup" Checked="WorkdaysRB_Checked" Margin="5" VerticalAlignment="Center" Grid.Row="1" IsChecked="{Binding Path=RecurrenceType,            Converter={StaticResource SelectedEnumMemberConverter},            ConverterParameter=Workdays}" Content="{Binding rbWorkdaysRB, Source={StaticResource C1_Schedule_EditRecurrence}}" />
                            </StackPanel>
                        </Grid>
                    </Border>
                    <Border Name="WeeklyDetails" Grid.Column="1">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition />
                                <ColumnDefinition />
                                <ColumnDefinition />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="44*" />
                                <RowDefinition Height="28*" />
                                <RowDefinition Height="28*" />
                            </Grid.RowDefinitions>
                            <StackPanel Grid.Row="0" Grid.ColumnSpan="4" Orientation="Horizontal">
                                <TextBlock Margin="10,2,0,2" VerticalAlignment="Center" Text="{Binding lblEveryWeek, Source={StaticResource C1_Schedule_EditRecurrence}}" />
                                <c1:C1NumericBox Name="everyWeek" AllowNull="False" Width="40" Padding="2" VerticalAlignment="Center" Margin="10,2,0,2" Minimum="1" Maximum="99" Format="#" Value="{Binding Path=Interval, NotifyOnValidationError=True, Mode=TwoWay}" />
                                <TextBlock Margin="10,2,0,2" VerticalAlignment="Center" Text="{Binding txtEveryWeek, Source={StaticResource C1_Schedule_EditRecurrence}}" />
                            </StackPanel>
                            <CheckBox Grid.Row="1" Grid.Column="0" Name="MondayCB" Unchecked="CheckBox_changed" Checked="CheckBox_changed" Margin="10,2,0,2" VerticalAlignment="Center" Content="{Binding Path=Scheduler.CalendarHelper.FullDayNames[1],                                          ElementName=root, Mode=OneWay}" />
                            <CheckBox Grid.Row="1" Grid.Column="1" Name="TuesdayCB" Unchecked="CheckBox_changed" Checked="CheckBox_changed" Margin="10,2,0,2" VerticalAlignment="Center" Content="{Binding Path=Scheduler.CalendarHelper.FullDayNames[2],                                          ElementName=root, Mode=OneWay}" />
                            <CheckBox Grid.Row="1" Grid.Column="2" Name="WednesdayCB" Unchecked="CheckBox_changed" Checked="CheckBox_changed" Margin="10,2,0,2" VerticalAlignment="Center" Content="{Binding Path=Scheduler.CalendarHelper.FullDayNames[3],                                          ElementName=root, Mode=OneWay}" />
                            <CheckBox Grid.Row="1" Grid.Column="3" Name="ThursdayCB" Unchecked="CheckBox_changed" Checked="CheckBox_changed" Margin="10,2,0,2" VerticalAlignment="Center" Content="{Binding Path=Scheduler.CalendarHelper.FullDayNames[4],                                          ElementName=root, Mode=OneWay}" />
                            <CheckBox Grid.Row="2" Grid.Column="0" Name="FridayCB" Unchecked="CheckBox_changed" Checked="CheckBox_changed" Margin="10,2,0,2" VerticalAlignment="Center" Content="{Binding Path=Scheduler.CalendarHelper.FullDayNames[5],                                          ElementName=root, Mode=OneWay}" />
                            <CheckBox Grid.Row="2" Grid.Column="1" Name="SaturdayCB" Unchecked="CheckBox_changed" Checked="CheckBox_changed" Margin="10,2,0,2" VerticalAlignment="Center" Content="{Binding Path=Scheduler.CalendarHelper.FullDayNames[6],                                          ElementName=root, Mode=OneWay}" />
                            <CheckBox Grid.Row="2" Grid.Column="2" Name="SundayCB" Unchecked="CheckBox_changed" Checked="CheckBox_changed" Margin="10,2,0,2" VerticalAlignment="Center" Content="{Binding Path=Scheduler.CalendarHelper.FullDayNames[0],                                          ElementName=root, Mode=OneWay}" />
                        </Grid>
                    </Border>
                    <Border Name="MonthlyDetails" Grid.Column="1">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="50*" />
                                <RowDefinition Height="50*" />
                            </Grid.RowDefinitions>
                            <StackPanel Grid.Row="0" Orientation="Horizontal">
                                <RadioButton GroupName="MonthlyButtons" x:Name="MonthlyRB" Checked="MonthlyRB_Checked" Margin="5" VerticalAlignment="Center" IsChecked="{Binding Path=RecurrenceType,            Converter={StaticResource SelectedEnumMemberConverter},            ConverterParameter=Monthly}" Content="{Binding rbMonthlyRB, Source={StaticResource C1_Schedule_EditRecurrence}}" />
                                <c1:C1NumericBox x:Name="MonthlyDetails11" GotFocus="MonthlyDetails11_GotFocus" AllowNull="False" Width="40" Padding="2" VerticalAlignment="Center" Margin="10,2,0,2" Minimum="1" Maximum="31" Format="#" Value="{Binding Path=DayOfMonth, NotifyOnValidationError=True, Mode=TwoWay}" />
                                <TextBlock Margin="10,2,0,2" VerticalAlignment="Center" Text="{Binding txtMonthly1, Source={StaticResource C1_Schedule_EditRecurrence}}" />
                                <c1:C1NumericBox Name="MonthlyDetails12" GotFocus="MonthlyDetails11_GotFocus" AllowNull="False" Width="40" Padding="2" VerticalAlignment="Center" Margin="10,2,0,2" Minimum="1" Maximum="99" Format="#" Value="{Binding Path=Interval, NotifyOnValidationError=True, Mode=TwoWay}" />
                                <TextBlock Margin="5" VerticalAlignment="Center" Text="{Binding txtMonthly2, Source={StaticResource C1_Schedule_EditRecurrence}}" />
                            </StackPanel>
                            <StackPanel Grid.Row="1" Orientation="Horizontal">
                                <RadioButton GroupName="MonthlyButtons" x:Name="MonthlyNthRB" Checked="MonthlyNthRB_Checked" Margin="5" VerticalAlignment="Center" IsChecked="{Binding Path=RecurrenceType,             Converter={StaticResource SelectedEnumMemberConverter},            ConverterParameter=MonthlyNth}" Content="{Binding rbMonthlyNthRB, Source={StaticResource C1_Schedule_EditRecurrence}}" />
                                <ComboBox x:Name="MonthlyDetails21" GotFocus="MonthlyDetails21_GotFocus" ItemTemplate="{StaticResource WeekOfMonthComboItemTemplate}" MinWidth="100" Padding="3" Margin="10,2,0,2" VerticalAlignment="Center" SelectedItem="{Binding Path=Instance, Mode=TwoWay}" />
                                <ComboBox Name="MonthlyDetails22" GotFocus="MonthlyDetails21_GotFocus" ItemTemplate="{StaticResource WeekDaysComboItemTemplate}" MinWidth="100" Padding="3" Margin="10,2,0,2" VerticalAlignment="Center" SelectedItem="{Binding Path=DayOfWeekMask,              Converter={StaticResource WeekDaysToIntConverter}, Mode=TwoWay}" />
                                <TextBlock Margin="10,2,0,2" VerticalAlignment="Center" Text="{Binding txtMonthlyNth1, Source={StaticResource C1_Schedule_EditRecurrence}}" />
                                <c1:C1NumericBox Name="MonthlyDetails23" AllowNull="False" GotFocus="MonthlyDetails21_GotFocus" Width="40" Padding="2" VerticalAlignment="Center" Margin="10,2,0,2" Minimum="1" Maximum="99" Format="#" Value="{Binding Path=Interval, NotifyOnValidationError=True, Mode=TwoWay}" />
                                <TextBlock Margin="10,2,0,2" VerticalAlignment="Center" Text="{Binding txtMonthlyNth2, Source={StaticResource C1_Schedule_EditRecurrence}}" />
                            </StackPanel>
                        </Grid>
                    </Border>
                    <Border Name="YearlyDetails" Grid.Column="1">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="50*" />
                                <RowDefinition Height="50*" />
                            </Grid.RowDefinitions>
                            <StackPanel Grid.Row="0" Orientation="Horizontal">
                                <RadioButton x:Name="YearlyRB" GroupName="YearlyGroup" Checked="YearlyRB_Checked" Margin="5" VerticalAlignment="Center" IsChecked="{Binding Path=RecurrenceType,             Converter={StaticResource SelectedEnumMemberConverter},            ConverterParameter=Yearly}" Content="{Binding rbYearlyRB, Source={StaticResource C1_Schedule_EditRecurrence}}" />
                                <ComboBox x:Name="YearlyDetails12" GotFocus="YearlyDetails12_GotFocus" SelectionChanged="YearlyDetails12_SelectionChanged" MinWidth="100" Padding="3" Margin="10,2,0,2" VerticalAlignment="Center" />
                                <c1:C1NumericBox x:Name="YearlyDetails11" GotFocus="YearlyDetails12_GotFocus" ValueChanged="YearlyDetails11_ValueChanged" AllowNull="False" Width="40" Padding="2" VerticalAlignment="Center" Margin="10,2,0,2" Minimum="1" Maximum="31" Format="#" Value="{Binding Path=DayOfMonth, NotifyOnValidationError=True, Mode=TwoWay}" />
                                <TextBlock Margin="10,2,0,2" VerticalAlignment="Center" Text="{Binding txtYearly, Source={StaticResource C1_Schedule_EditRecurrence}}" />
                            </StackPanel>
                            <StackPanel Grid.Row="1" Orientation="Horizontal">
                                <RadioButton x:Name="YearlyNthRB" GroupName="YearlyGroup" Checked="YearlyNthRB_Checked" Margin="5" VerticalAlignment="Center" IsChecked="{Binding Path=RecurrenceType,            Converter={StaticResource SelectedEnumMemberConverter},            ConverterParameter=YearlyNth}" Content="{Binding rbYearlyNthRB, Source={StaticResource C1_Schedule_EditRecurrence}}" />
                                <ComboBox x:Name="YearlyDetails21" GotFocus="YearlyDetails21_GotFocus" ItemTemplate="{StaticResource WeekOfMonthComboItemTemplate}" MinWidth="100" Padding="3" Margin="10,2,0,2" VerticalAlignment="Center" SelectedItem="{Binding Path=Instance, Mode=TwoWay}" />
                                <ComboBox Name="YearlyDetails22" GotFocus="YearlyDetails21_GotFocus" ItemTemplate="{StaticResource WeekDaysComboItemTemplate}" MinWidth="100" Padding="3" Margin="10,2,0,2" VerticalAlignment="Center" SelectedItem="{Binding Path=DayOfWeekMask,              Converter={StaticResource WeekDaysToIntConverter}, Mode=TwoWay}" />
                                <TextBlock Margin="10,2,0,2" VerticalAlignment="Center" Text="{Binding txtYearlyNth1, Source={StaticResource C1_Schedule_EditRecurrence}}" />
                                <ComboBox Name="YearlyDetails23" GotFocus="YearlyDetails21_GotFocus" MinWidth="100" Padding="3" Margin="10,2,0,2" VerticalAlignment="Center" />
                                <TextBlock Margin="10,2,0,2" VerticalAlignment="Center" Text="{Binding txtYearlyNth2, Source={StaticResource C1_Schedule_EditRecurrence}}" />
                            </StackPanel>
                        </Grid>
                    </Border>
                </Grid>
            </ContentControl.Content>
        </c1:C1HeaderedContentControl>
        <c1:C1HeaderedContentControl x:Name="Range" Grid.Row="2" Template="{StaticResource GroupTemplate}" Margin="5" Padding="5" BorderThickness="1" Foreground="{Binding Foreground, ElementName=root}" HeaderForeground="{Binding Foreground, ElementName=root}" Header="{Binding grpRange, Source={StaticResource C1_Schedule_EditRecurrence}}">
            <ContentControl.Content>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="33*" />
                        <RowDefinition Height="33*" />
                        <RowDefinition Height="33*" />
                    </Grid.RowDefinitions>
                    <StackPanel Grid.Row="0" Grid.Column="0" Orientation="Horizontal">
                        <TextBlock Margin="10,2,0,2" VerticalAlignment="Center" Text="{Binding start, Source={StaticResource C1_Schedule_EditRecurrence}}" />
                        <c1:C1DateTimePicker x:Name="patternStartDate" EditMode="Date" HorizontalAlignment="Left" DateFormat="Long" FirstDayOfWeek="{Binding Path=Scheduler.CalendarHelper.WeekStart, ElementName=root}" Padding="1" Margin="10,2,0,2" VerticalAlignment="Center" DateTime="{Binding PatternStartDate, Mode=TwoWay}" />
                    </StackPanel>
                    <RadioButton x:Name="noEndDate" Grid.Row="0" Grid.Column="1" Margin="5" GroupName="grpRange" Content="{Binding rbNoEndDate, Source={StaticResource C1_Schedule_EditRecurrence}}" Checked="noEndDate_Checked" />
                    <RadioButton x:Name="endAfter" Grid.Row="1" Grid.Column="1" GroupName="grpRange" Margin="5" Content="{Binding rbEndAfter, Source={StaticResource C1_Schedule_EditRecurrence}}" Checked="endAfter_Checked" />
                    <StackPanel Grid.Row="1" Grid.Column="2" Orientation="Horizontal">
                        <c1:C1NumericBox x:Name="occurences" AllowNull="True" Width="40" Watermark="0" GotFocus="occurences_GotFocus" Padding="2" VerticalAlignment="Center" Margin="10,2,0,2" Minimum="0" Maximum="999" Format="##" ValueChanged="occurences_ValueChanged" Value="{Binding Path=Occurrences, Mode=TwoWay}" />
                        <TextBlock Margin="10,2,0,2" VerticalAlignment="Center" Text="{Binding occurrences, Source={StaticResource C1_Schedule_EditRecurrence}}" />
                    </StackPanel>
                    <RadioButton x:Name="endBy" Grid.Row="2" Grid.Column="1" GroupName="grpRange" Margin="5" Content="{Binding rbEndBy, Source={StaticResource C1_Schedule_EditRecurrence}}" Checked="endBy_Checked" />
                    <c1:C1DateTimePicker x:Name="patternEndDate" GotFocus="patternEndDate_GotFocus" EditMode="Date" Grid.Row="2" Grid.Column="2" FirstDayOfWeek="{Binding Path=Scheduler.CalendarHelper.WeekStart, ElementName=root}" HorizontalAlignment="Left" DateFormat="Long" Padding="1" Margin="10,2,0,2" VerticalAlignment="Center" DateTimeChanged="patternEndDate_DateTimeChanged" />
               </Grid>
            </ContentControl.Content>
        </c1:C1HeaderedContentControl>
		<Border Margin="-5,0,-5,-5" Grid.Row="3" Padding="0,0,5,5" BorderBrush="{StaticResource BorderBrush}" BorderThickness="0,1,0,0">
	            <Border.Background>
                    <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
                        <LinearGradientBrush.GradientStops>
                            <GradientStop Color="#26000000" Offset="1" />
                        </LinearGradientBrush.GradientStops>
                    </LinearGradientBrush>
                </Border.Background>
		        <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,5,5,0">
		            <Button x:Name="PART_DialogOkButton" Padding="5" MinWidth="70" Margin="10,2,0,2" VerticalAlignment="Center" Click="PART_DialogOkButton_Click" Content="{Binding btnOk, Source={StaticResource C1_Schedule_EditRecurrence}}" /><!--IsEnabled="{Binding HasNoErrors, ElementName=whenErrorsIndicator}"-->
		            <Button x:Name="PART_DialogCancelButton" Click="PART_DialogCancelButton_Click" Padding="5" MinWidth="70" Margin="10,2,0,2" VerticalAlignment="Center" Content="{Binding btnCancel, Source={StaticResource C1_Schedule_EditRecurrence}}" />
		            <Button x:Name="PART_DialogCustomButton" Padding="5" MinWidth="70" Margin="10,2,0,2" VerticalAlignment="Center" Click="PART_DialogCustomButton_Click" Content="{Binding btnRemove, Source={StaticResource C1_Schedule_EditRecurrence}}" /> 
		        </StackPanel>
			</Border>	
    </Grid>
</UserControl>