public override void OnApplyTemplate() {
base.OnApplyTemplate();
if (_thumb != null) {
_thumb.DragDelta -= Thumb_DragDelta;
_thumb.DragStarted -= Thumb_DragStarted;
_thumb.DragCompleted -= Thumb_DragCompleted;
}
if (_wrapper != null) {
_wrapper.MouseWheel -= Wrapper_MouseWheel;
}
_thumb = GetTemplateChild(@"PART_Thumb") as Thumb;
_wrapper = GetTemplateChild(@"PART_Wrapper") as FrameworkElement;
if (_thumb != null) {
_thumb.DragDelta += Thumb_DragDelta;
_thumb.DragStarted += Thumb_DragStarted;
_thumb.DragCompleted += Thumb_DragCompleted;
}
if (_wrapper != null) {
_wrapper.MouseWheel += Wrapper_MouseWheel;
}
}