private void SwiperBtn_MouseMove(object sender, MouseEventArgs e)
 {
     if (isMouseDownSwiperBtn && DisPlayPanel.Switch)
     {
         end_y = e.GetPosition(SwiperCanvas).Y;
         SwiperBtn btn = (SwiperBtn)sender;
         double    val = first + (end_y - start_y);
         if (val < -10)
         {
             val = -10;
         }
         if (val > DisPlayPanel.Height - 10)
         {
             val = DisPlayPanel.Height - 10;
         }
         foreach (ChannelItem ch in Channels)
         {
             if (btn.Id == ch.Id)
             {
                 ch.Offset_Y = DisPlayPanel.Height / 2 - val - 10;
             }
         }
         btn.SetValue(Canvas.TopProperty, val);
         e.Handled = true;
     }
 }
        private void SwiperBtn_MouseDown(object sender, MouseButtonEventArgs e)
        {
            isMouseDownSwiperBtn = true;
            start_y = e.GetPosition(SwiperCanvas).Y;
            SwiperBtn btn = (SwiperBtn)sender;

            first = (double)btn.GetValue(Canvas.TopProperty);
        }
        /// <summary>
        /// 添加滑块按钮
        /// </summary>
        /// <param name="ch"></param>
        private void AddSwiperBtn(ChannelItem ch)
        {
            SwiperBtn btn = new SwiperBtn();

            btn.Id = ch.Id;
            Binding binding = new Binding {
                Source = ch, Path = new PropertyPath("Color")
            };

            btn.SetBinding(SwiperBtn.colorProperty, binding);
            Binding binding1 = new Binding {
                Source = ch, Path = new PropertyPath("Name")
            };

            btn.SetBinding(SwiperBtn.nameProperty, binding1);
            double val = (double)(DisPlayPanel.Height / 2 - 10 - ch.Offset_Y);

            btn.SetValue(Canvas.TopProperty, val);
            btn.PreviewMouseDown += SwiperBtn_MouseDown;
            btn.PreviewMouseMove += SwiperBtn_MouseMove;
            btn.PreviewMouseUp   += SwiperBtn_MouseUp;
            this.SwiperCanvas.Children.Add(btn);
        }