コード例 #1
0
ファイル: TsiFileViewModel.cs プロジェクト: pestrela/cmdr
        private void dragOver(DragEventArgs e)
        {
            IDataObject dataObject = e.Data;

            if (dataObject == null)
            {
                return;
            }

            var data = dataObject.GetData(typeof(DraggableRowsBehavior.Data)) as DraggableRowsBehavior.Data;

            if (data == null)
            {
                return;
            }

            var lbItem = VisualHelpers.FindAncestor <ListBoxItem>(e.OriginalSource);

            if (lbItem != null)
            {
                lbItem.IsSelected = true;
            }

            // add appropriate device for mappings, if file is empty
            if (!Devices.Any())
            {
                var copy = (data.SenderDataContext as DeviceViewModel).Copy(false);
                addDevice(copy);
                SelectedDevice = Devices.First();
            }
        }
コード例 #2
0
        public override bool IsValidDropTarget(DependencyObject control)
        {
            if (getRow(control) != null)
            {
                return(true);
            }

            // allow drop on empty selector
            var grid = VisualHelpers.FindAncestor <DataGrid>(control);

            if (grid != null && !grid.HasItems)
            {
                return(true);
            }

            return(false);
        }
コード例 #3
0
        public override bool IsValidDropTarget(DependencyObject control)
        {
            if (getListBoxItem(control) != null)
            {
                return(true);
            }

            // allow drop on empty selector
            var listbox = VisualHelpers.FindAncestor <ListBox>(control);

            if (listbox != null && !listbox.HasItems)
            {
                return(true);
            }

            return(false);
        }
コード例 #4
0
 private DataGridRow getRow(DependencyObject control)
 {
     return(VisualHelpers.FindAncestor <DataGridRow>(control));
 }
コード例 #5
0
 private ListBoxItem getListBoxItem(DependencyObject control)
 {
     return(VisualHelpers.FindAncestor <ListBoxItem>(control));
 }