コード例 #1
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));
        }
コード例 #2
0
        public void DragStart(DragInfo info)
        {
            VideoPanelItem vpi = info.Source as VideoPanelItem;

            if (vpi.VideoControl != null)
            {
                Binding binding = new Binding();
                binding.Mode   = BindingMode.OneWay;
                binding.Source = vpi.VideoControl.videoDisp;
                vpi.SetBinding(DragDropVisual.VisualProperty, binding);
                _topWin = FindTopWindow(vpi);
                updateOpacity(vpi, 0);
            }
        }