public override void OnApplyTemplate() { base.OnApplyTemplate(); var descriptor = Orientation == Orientation.Horizontal ? DependencyPropertyExtensions.FromProperty <ContentControl>(ActualWidthProperty) : DependencyPropertyExtensions.FromProperty <ContentControl>(ActualHeightProperty); var handler = Orientation == Orientation.Horizontal ? new EventHandler(OnContentActualWidthChanged) : new EventHandler(OnContentActualHeightChanged); if (_contentPresenter != null) { descriptor.RemoveValueChanged(_contentPresenter, handler); } _contentPresenter = GetTemplateChild(ContentPresenterPartName) as FrameworkElement; _thumb = GetTemplateChild(ThumbPartName) as FrameworkElement; if (_contentPresenter != null) { descriptor.AddValueChanged(_contentPresenter, handler); if (ContentWidth > 0) { _contentPresenter.Width = ContentWidth; } if (ContentHeight > 0) { _contentPresenter.Height = ContentHeight; } } }
protected override void OnAttached() { if (string.IsNullOrEmpty(Source)) { return; } _associatedType = AssociatedObject.GetType(); _descriptor = DependencyPropertyExtensions.GetDependencyPropertyDescriptor(_associatedType, Source); _descriptor.AddValueChanged(AssociatedObject, OnSourceValueChanged); }
static AppointmentSlotPresenter() { // TODO: Move to the control Style FocusableProperty.OverrideMetadata( typeof(AppointmentSlotPresenter), new FrameworkPropertyMetadata(BooleanBoxes.TrueBox)); IsEditingSubjectPropertyKey = DependencyPropertyExtensions.RegisterReadOnly( "IsEditingSubject", typeof(bool), typeof(AppointmentSlotPresenter), new PropertyMetadata(BooleanBoxes.FalseBox, OnIsEditingSubjectChanged)); IsEditingSubjectProperty = IsEditingSubjectPropertyKey.DependencyProperty; }
static AppointmentDialogWindow() { CommandManager.RegisterClassCommandBinding( typeof(AppointmentDialogWindow), new CommandBinding(RadSchedulerCommands.SaveAppointment, OnSaveAppointmentCommand, OnQuerySaveAppointmentCommand)); CommandManager.RegisterClassCommandBinding( typeof(AppointmentDialogWindow), new CommandBinding(RadSchedulerCommands.EditRecurrenceRule, OnEditRecurrenceCommand, OnQueryEditRecurrenceCommand)); CommandManager.RegisterClassCommandBinding( typeof(AppointmentDialogWindow), new CommandBinding(RadSchedulerCommands.EditParentAppointment, OnEditParentAppointmentCommand, OnQueryEditParentAppointmentCommand)); CommandManager.RegisterClassCommandBinding( typeof(AppointmentDialogWindow), new CommandBinding(RadSchedulerCommands.ChangeTimePickersVisibility, ChangeTimePickersVisibilityCommand)); CommandManager.RegisterClassCommandBinding( typeof(AppointmentDialogWindow), new CommandBinding(RadSchedulerCommands.SetAppointmentImportance, SetAppointmentImportanceCommand)); EditedAppointmentPropertyKey = DependencyPropertyExtensions.RegisterReadOnly( "EditedAppointment", typeof(IAppointment), typeof(AppointmentDialogWindow), new PropertyMetadata()); EditedAppointmentProperty = EditedAppointmentPropertyKey.DependencyProperty; ResourceTypeModelsPropertyKey = DependencyPropertyExtensions.RegisterReadOnly( "ResourceTypeModels", typeof(ResourceTypeViewModelCollection), typeof(AppointmentDialogWindow), new PropertyMetadata()); ResourceTypeModelsProperty = ResourceTypeModelsPropertyKey.DependencyProperty; }
static DateTimePicker() { TimeItemsPropertyKey = DependencyPropertyExtensions.RegisterReadOnly( "TimeItems", typeof(ObservableCollection <TimeSpan>), typeof(DateTimePicker), new PropertyMetadata(null)); TimeItemsProperty = TimeItemsPropertyKey.DependencyProperty; }