Пример #1
0
 private void RemoveVideoFromInitParent(VideoPanelItem vpi)
 {
     _parent    = vpi.Parent as Panel;
     _lastIndex = _parent.Children.IndexOf(vpi);
     _parent.Children.Remove(vpi);
     _vpi = vpi;
     _vpi.SetValue(DragDropTool.AllowDragProperty, false);
     _parent.Visibility = Visibility.Collapsed;
 }
Пример #2
0
        //设置视频窗口的可拖拽属性。
        private void SetDragDropParam(VideoPanelItem vpi)
        {
            vpi.SetValue(DragDropTool.AllowDropProperty, true);
            vpi.SetValue(DragDropTool.DropHandlerProperty, new VideoPanelDropHandler());
            vpi.SetValue(DragDropTool.DragHandlerProperty, new VideoPanelDragHandler());
            //允许拖动
            Binding binding = CreateBinding(vpi.DataContext, BindingMode.OneWay, "ControlViewModel.IsVisible");

            vpi.SetBinding(DragDropTool.AllowDragProperty, binding);

            //设置拖动数据
            binding = CreateBinding(vpi.DataContext, BindingMode.OneWay, "ControlViewModel.VideoId");
            vpi.SetBinding(DragDropData.DataProperty, binding);

            //设置可视化
            vpi.SetValue(DragDropVisual.ShadowVisibleProperty, true);
            vpi.SetValue(DragDropVisual.ShadowColorProperty, Color.FromRgb(0, 255, 0));
            vpi.SetValue(DragDropVisual.BorderThicknessProperty, new Thickness(2));
        }