Пример #1
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
 {
     switch (connectionId)
     {
     case 1:
         this.slider = ((VideoMetaInfo.common.CustomSlider)(target));
         return;
     }
     this._contentLoaded = true;
 }
Пример #2
0
        private static void CustomSlider_PreviewMouseMove(object sender, MouseEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed)
            {
                CustomSlider slider = sender as CustomSlider;

                Point point = e.GetPosition(slider);

                // 현재 Slider 내 마우스 좌표 값을 Value 값으로 계산.
                slider.Value = point.X / (slider.ActualWidth / slider.Maximum);

                RoutedEventArgs args = new RoutedEventArgs(MoveEvent, typeof(CustomSlider));
                slider.RaiseEvent(args);
            }
        }
Пример #3
0
        private static void ChangeAutoMoveProperty(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            CustomSlider slider = d as CustomSlider;

            if (slider != null)
            {
                if ((bool)e.NewValue)
                {
                    slider.defaultIsMoveToPointEnabled = slider.IsMoveToPointEnabled;
                    slider.IsMoveToPointEnabled        = true;
                    slider.PreviewMouseMove           += CustomSlider_PreviewMouseMove;
                }
                else
                {
                    slider.IsMoveToPointEnabled = slider.defaultIsMoveToPointEnabled;
                    slider.PreviewMouseMove    -= CustomSlider_PreviewMouseMove;
                }
            }
        }