This question is locked. New answers and comments are not allowed.
In our system we have decided not to allow unlimited recurrence for appointments. I can easily modify the EditRecurrenceTemplate to just hide the radio button for that option, but I cannot find a good way of setting the default value on the underlying RecurrenceDialogViewModel when it is loaded. I came up with a behaviour that I attached to the root grid of the EditRecurrenceTemplate (the code is pasted below in case anybody else needs this). By listening to the Loaded event of the grid, I can catch the RecurrenceDialogViewModel and change the default value if it is set to NoEndDate. This works, but it is of course a hack. It would be great if we had something like a RecurrenceDialogInitializing event where we could intercept the object immediately after creation and adjust the values.
My behaviour:
My behaviour:
/// <summary>/// Workaround for setting default values in Recurrence editor of RadScheduleView. /// </summary>public class SetDefaultRecurrenceValuesOnLoad : Behavior<FrameworkElement>{ protected override void OnAttached() { this.AssociatedObject.Loaded += AssociatedObject_Loaded; base.OnAttached(); } protected override void OnDetaching() { this.AssociatedObject.Loaded -= AssociatedObject_Loaded; base.OnDetaching(); } void AssociatedObject_Loaded(object sender, RoutedEventArgs e) { var rule = sender.GetDataContext<RecurrenceDialogViewModel>(); if (rule != null) { if (rule.RecurrenceRangeType == RecurrenceRangeType.NoEndDate) { //NoEndDate is not allowed for our stuff, so we must change it here. rule.RecurrenceRangeType = RecurrenceRangeType.MaxOccurrences; } } }}