/// <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); }
private void listBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { SelectedChannelItem = (ChannelItem)listBox.SelectedItem; }