Beispiel #1
0
 private void OnTimeSlotItemsControlDropQuery(object sender, DragDropQueryEventArgs e)
 {
     if (e.Options.DragCue != null)
     {
         e.QueryResult = true;
     }
 }
Beispiel #2
0
        private void OnDropQuery(object sender, DragDropQueryEventArgs e)
        {
            if (e.Options.Status == DragStatus.DropDestinationQuery)
            {
                var destination = e.Options.Destination;
                var listBox     = destination.FindItemsConrolParent() as ListBox;

                //Cannot place na item relative to itself:
                if (e.Options.Source == e.Options.Destination)
                {
                    return;
                }

                VisualStateManager.GoToState(listBox, "DropPossible", false);

                //Get the spacial relation between the destination item and the vis. root:
                var destinationTopLeft = destination.TransformToVisual(null).Transform(new Point());

                //Should the new Item be moved before or after the destination item?:
                bool placeBefore = (e.Options.CurrentDragPoint.Y - destinationTopLeft.Y) < destination.ActualHeight / 2;

                var operation = e.Options.Payload as DragDropOperation;

                operation.DropPosition = placeBefore ? DropPosition.Before : DropPosition.After;

                e.QueryResult = true;
                e.Handled     = true;
            }
        }
Beispiel #3
0
        private void OnDragQuery(object sender, DragDropQueryEventArgs e)
        {
            if (e.Options.Status == DragStatus.DragQuery)
            {
                e.QueryResult = true;
                e.Handled     = true;

                var sourceControl = e.Options.Source;

                var dragCue = RadDragAndDropManager.GenerateVisualCue(sourceControl);
                dragCue.HorizontalAlignment        = HorizontalAlignment.Left;
                dragCue.Content                    = sourceControl.DataContext;
                dragCue.ContentTemplate            = App.Current.Resources["TrackDragCueTemplate"] as DataTemplate;
                dragCue.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Stretch;
                e.Options.DragCue                  = dragCue;

                e.Options.Payload = new DragDropOperation()
                {
                    Payload = sourceControl.DataContext
                };
            }

            if (e.Options.Status == DragStatus.DropSourceQuery)
            {
                e.QueryResult = true;
                e.Handled     = true;
            }
        }
Beispiel #4
0
        /// <summary>
        /// On DragQuery
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnDragQuery(object sender, DragDropQueryEventArgs e)
        {
            //Limit Drag Behavior to GridViewRow
            if (!(e.Options.Source is GridViewRow))
            {
                return;
            }

            //sender should be of type RadGridView
            var gridView = sender as RadGridView;

            if (gridView == null)
            {
                return;
            }

            this.AssociatedObject.ReleaseMouseCapture();
            this.previousScrollAdjustPosition = e.Options.CurrentDragPoint;
            if (this.IsInScrollableArea(this.previousScrollAdjustPosition))
            {
                this.scrollViewerScrollTimer.Start();
            }
            e.QueryResult = this.InitiateDrag(gridView, e);
            e.Handled     = true;
        }
 // OnDropQuery event handler
 private void OnDropQuery(object sender, DragDropQueryEventArgs e)
 {
     if (e.Options.Status == DragStatus.DropDestinationQuery)
     {
         e.QueryResult = true;
         e.Handled     = true;
     }
 }
        private void ExecuteDragQueryCommand(DragDropQueryEventArgs obj)
        {
            var dragItem = obj.Options.Payload as ProgramEnrollmentDto;

            if (dragItem != null)
            {
                obj.QueryResult = dragItem.IsActive;
            }
        }
        private void ExecuteDragQuery(DragDropQueryEventArgs obj)
        {
            var dragItem = obj.Options.Payload as DirectMailDto;

            if (dragItem != null)
            {
                obj.QueryResult = true;
            }
        }
        private void ExecuteDragQueryCommand(DragDropQueryEventArgs obj)
        {
            var dragItem = obj.Options.Payload as ProblemDto;

            if (dragItem != null)
            {
                obj.QueryResult = dragItem.ProblemStatus.WellKnownName == ProblemStatus.Active;
            }
        }
        private void TreeDropQuery(object sender, DragDropQueryEventArgs e)
        {
            var draggedItems = new List <IDraggable>();
            var items        = ListView.SelectedItems as IEnumerable;

            var t = e.Options.Source.DataContext as ListTimeEntryViewModel;

            if (t != null && t.TimeEntry.DocumentType == 2)
            {
                e.Handled = false;
                return;
            }
            if (e.Options.Source.DataContext is ListTaskViewModel || e.Options.Source.DataContext is ListProjectViewModel || e.Options.Source.DataContext is ListCustomerViewModel)
            {
                e.Handled = false;
                return;
            }

            var destinationTreeItem = e.Options.Destination as RadTreeViewItem;

            if (destinationTreeItem != null && destinationTreeItem.DropPosition != DropPosition.Inside)
            {
                e.QueryResult = false;
                e.Handled     = true;
                return;
            }

            if (e.Options.Payload is IEnumerable)
            {
                var enumerator = ((IEnumerable)e.Options.Payload).GetEnumerator();

                draggedItems.AddRange(from object item in items where enumerator.MoveNext() select enumerator.Current as IDraggable);
            }
            else if (e.Options.Payload is IDraggable)
            {
                draggedItems.Add(e.Options.Payload as IDraggable);
            }

            var destinationItem = e.Options.Destination.DataContext as IDraggable;

            if (destinationItem != null && draggedItems != null)
            {
                foreach (var draggedIte in draggedItems)
                {
                    e.QueryResult = destinationItem.Entity.IsValidChild(draggedIte.Entity);
                }
            }
            else
            {
                e.QueryResult = false;
            }

            e.Handled = true;
        }
Beispiel #10
0
        private void OnDropQuery(object sender, DragDropQueryEventArgs e)
        {
            if (!(e.Options.Source is GridViewRow))
            {
                return;
            }

            e.QueryResult = true;
            e.Handled     = true;
            // CHECK IF THE SOURCE COLLECTION CAN BE MODIFIED
        }
        private void OnAppointmentItemsControlDragQuery(object sender, DragDropQueryEventArgs e)
        {
            ////TODO: change the following code for the SP.

            var button = e.GetElement <ButtonBase>(e.Options.CurrentDragPoint);

            if (button == null)
            {
                e.QueryResult = !this.Scheduler.IsReadOnly && !this.IsResizing;
            }
            else
            {
                e.QueryResult = false;
            }

            if (e.QueryResult == true && e.Options.u_IsStatus)
            {
                this.IsDragging = true;
                var item         = e.Options.Source as AppointmentItem;
                var editingEvent = this.RaiseAppointmentEditingEvent(item.AppointmentSlot.Occurrence.Appointment, AppointmentEditAction.Drag);
                if (!editingEvent.Cancel)
                {
                    e.Options.Payload = e.Options.Source;
                    ContentControl cue = new ContentControl();
                    cue.ContentTemplate            = item.Scheduler.DragVisualCueTemplate;
                    cue.Content                    = new DragVisualCue(item.AppointmentSlot.Occurrence.Appointment, true);
                    cue.Width                      = item.ActualWidth;
                    cue.MinHeight                  = item.ActualHeight;
                    cue.HorizontalContentAlignment = HorizontalAlignment.Stretch;
                    cue.VerticalContentAlignment   = VerticalAlignment.Stretch;
                    e.Options.DragCue              = cue;

                    TimeSlotItem timeslotItem = e.GetElement <TimeSlotItem>(e.Options.MouseClickPoint);
                    if (timeslotItem == null)
                    {
                        e.QueryResult   = false;
                        this.IsDragging = false;
                        return;
                    }
                    TimeSlot sl   = timeslotItem.TimeSlot;
                    TimeSlot apps = (item.Content as AppointmentSlot).TimeSlot;
                    if (this.Scheduler != null)
                    {
                        this.Scheduler.DroppedAppointmentDuration = (sl.Start - apps.Start).Duration();
                    }
                }
                else
                {
                    this.IsDragging = true;
                    e.QueryResult   = false;
                }
            }
        }
        public static void OnDropQuery(object sender, DragDropQueryEventArgs e)
        {
            var destination = e.Options.Destination as ListBox;

            if (e.Options.Status == DragStatus.DropDestinationQuery &&
                destination != null)
            {
                var dropTarget = destination.DataContext as IDropTarget;
                e.QueryResult = dropTarget.CanDrop(e.Options.Payload) && !dropTarget.IsBusy;
                e.Handled     = true;
            }
        }
Beispiel #13
0
        private bool InitiateDrag(RadGridView gridView, DragDropQueryEventArgs dragDropArgs)
        {
            var itemsToDrag = this.GetItemsToReorder(gridView);
            var eventArgs   = new BeginningDragEventArgs(gridView, itemsToDrag);

            this.OnBeginningDrag(eventArgs);
            if (!eventArgs.Cancel)
            {
                dragDropArgs.Options.Payload = itemsToDrag;
                this.OnDragStarted(new DragStartedEventArgs(gridView, itemsToDrag));
            }
            return(!eventArgs.Cancel);
        }
Beispiel #14
0
        private void ExecuteDropQueryCommand(DragDropQueryEventArgs obj)
        {
            var result = false;

            if (obj.Options.Payload is ProblemDto)
            {
                var problemDto = obj.Options.Payload as ProblemDto;
                var probQuery  =
                    ProblemList.FirstOrDefault(
                        d => d.ProblemCodeCodedConcept.CodedConceptCode == problemDto.ProblemCodeCodedConcept.CodedConceptCode);
                result = probQuery == null;
            }
            obj.QueryResult = result;
        }
Beispiel #15
0
        /// <summary>
        /// Called when [drop query].
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="Telerik.Windows.Controls.DragDrop.DragDropQueryEventArgs"/> instance containing the event data.</param>
        protected virtual void OnDropQuery(object sender, DragDropQueryEventArgs e)
        {
            e.QueryResult = true;

            if (e.Options.Status == DragStatus.DropDestinationQuery)
            {
                if (DropQueryCommand != null)
                {
                    DropQueryCommand.Execute(e);
                }
            }

            e.Handled = true;
        }
Beispiel #16
0
        private void OnDropQuery(object sender, DragDropQueryEventArgs e)
        {
            // Ask the destination if dropping is possible
            if (e.Options.Status == DragStatus.DropDestinationQuery)
            {
                var source      = e.Options.Payload as IDraggable;
                var destination = DataContext as IDraggable;
                if (source != null && destination != null)
                {
                    e.QueryResult = destination.Entity.IsValidChild(source.Entity);
                }

                e.Handled = true;
            }
        }
Beispiel #17
0
        private void OnGridViewRowDropQuery(object sender, DragDropQueryEventArgs e)
        {
            this.AssociatedObject.ReleaseMouseCapture();
            var             row          = sender as GridViewRow;
            var             draggedItems = e.Options.Payload as IEnumerable <object>;
            TreeViewDragCue cue          = e.Options.DragCue as TreeViewDragCue;

            if (e.Options.Status == DragStatus.DropDestinationQuery)
            {
                this.currentDropItem     = row.Item;
                this.currentDropPosition = this.GetDropPositionFromPoint(e.Options.CurrentDragPoint, row);
                e.QueryResult            = !draggedItems.Contains(this.currentDropItem);
                if (!e.QueryResult.Value)
                {
                    this.ClearDragCueContent(cue);
                }
            }
            e.Handled = true;
        }
 private void OnDropQuery(object sender, DragDropQueryEventArgs e)
 {
     // Ask the destination if dropping is possible
     if (e.Options.Status == DragStatus.DropDestinationQuery)
     {
         // Check whether the source and the target are not the same
         if (this != e.Options.Source)
         {
             //DragRequest request = e.Options.Payload as DragRequest;
             // Check whether the control where the dragged object comes from is
             // different than the one we are dropping the object onto.
             //e.QueryResult = (request.ItemsHost != this);
             var destination = e.Options.Payload;
             e.QueryResult = true;
             //if (e.QueryResult == true)
             //{
             //    e.Handled = true;
             //}
         }
     }
 }
 // OnDragQuery event handler
 private void OnDragQuery(object sender, DragDropQueryEventArgs e)
 {
     if (e.Options.Status == DragStatus.DragQuery && Keyboard.Modifiers == ModifierKeys.Control)
     {
         var draggedItem = e.Options.Source;
         e.QueryResult = true;
         e.Handled     = true;
         //RadMap1.mous
         // Create Drag and Arrow Cue
         ContentControl dragCue = new ContentControl();
         dragCue.Content         = draggedItem.DataContext;
         dragCue.ContentTemplate = this.gridMain.Resources["F1"] as DataTemplate;
         e.Options.DragCue       = dragCue;
         e.Options.ArrowCue      = RadDragAndDropManager.GenerateArrowCue();
         // Set the payload (this is the item that is currently dragged)
         e.Options.Payload = draggedItem.DataContext;
     }
     if (e.Options.Status == DragStatus.DropSourceQuery)
     {
         e.QueryResult = true;
         e.Handled     = true;
     }
 }
        private void OnDragQuery(object sender, DragDropQueryEventArgs e)
        {
            var listBoxItem = e.Options.Source as ListBoxItem;
            var box = ItemsControl.ItemsControlFromItemContainer(listBoxItem) as ListBox;
            var cue = new ContentControl();

            if (e.Options.Status == DragStatus.DragQuery && box != null)
            {
                if (box.SelectedItem.GetType() == typeof(BasicFieldInfo))
                {
                    e.Options.Payload = ((BasicFieldInfo)box.SelectedItem).SystemName;
                    cue.Content = ((BasicFieldInfo)box.SelectedItem).Name;
                }
                else if (box.SelectedItem.GetType() == typeof(BasicProcessInfo))
                {
                    e.Options.Payload = ((BasicProcessInfo)box.SelectedItem).SystemName;
                    cue.Content = ((BasicProcessInfo)box.SelectedItem).Name;
                }

                e.Options.DragCue = cue;
            }
            e.QueryResult = e.Options.Payload != null;
        }
Beispiel #21
0
 private void OnDragQuery(object sender, DragDropQueryEventArgs e)
 {
     if (e.Options.Status == DragStatus.DragQuery)
     {
         e.Options.Payload = _resultsGrid.SelectedItem;
         if (DragStartingCommand != null)
         {
             DragStartingCommand.Execute(e);
         }
         var cue = new Border();
         cue.Style = Application.Current.Resources["DragBorderStyle"] as Style;
         var content = new ContentControl();
         content.ContentTemplate = ResultTemplates.Count > 0 ? ResultTemplates[0] : null;
         content.Content         = _resultsGrid.SelectedItem;
         cue.Child         = content;
         e.Options.DragCue = cue;
         RadDragAndDropManager.DragCueOffset = GetEffectiveDragOffset(e.Options);
         QuickSearchText = string.Empty;
         ExecuteCloseCommand();
         SelectedResult = _resultsGrid.SelectedItem;
     }
     e.QueryResult = true;
 }
Beispiel #22
0
        private void ExecuteDropQueryCommand(DragDropQueryEventArgs obj)
        {
            var directMail = obj.Options.Payload as DirectMailDto;

            if (directMail == null)
            {
                return;
            }

            _navigationService.Navigate(
                RegionManager,
                "WorkspaceContentScopedRegion",
                ExternalPatientHistoryView,
                null,
                new[]
            {
                new KeyValuePair <string, string> ("PatientKey", _patientKey.ToString()),
                new KeyValuePair <string, string> ("MailId", directMail.Id.ToString()),
                new KeyValuePair <string, string> ("MailFolderName", directMail.FolderName),
                new KeyValuePair <string, string> ("AttachmentName", directMail.AttachmentName),
                new KeyValuePair <string, string> ("MailFromName", string.IsNullOrWhiteSpace(directMail.FromName) ? directMail.From : directMail.FromName),
            });
        }
Beispiel #23
0
        /// <summary>
        /// Called when [drag query].
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="Telerik.Windows.Controls.DragDrop.DragDropQueryEventArgs"/> instance containing the event data.</param>
        protected virtual void OnDragQuery(object sender, DragDropQueryEventArgs e)
        {
            e.QueryResult = true;

            if (e.Options.Status == DragStatus.DragQuery)
            {
                var dataConext = ((e.Source) as FrameworkElement).DataContext;
                if (dataConext != null)
                {
                    e.Options.Payload = dataConext;

                    if (DragQueryCommand != null)
                    {
                        DragQueryCommand.Execute(e);
                    }
                }
                else
                {
                    e.QueryResult = false;
                }
            }

            e.Handled = true;
        }
        private void OnDragQuery(object sender, DragDropQueryEventArgs e)
        {
            // An object is about the be dragged
            if (e.Options.Status == DragStatus.DragQuery)
            {
                // Set result to true
                e.QueryResult = true;
                // Get the string representation of the item that is being dragged
                var draggedItem = (ListBoxItem)e.Options.Source;
                // Put a new instance of the DragRequest class within Payload
                // The DragRequest instance contains the string representation of the object being dragged,
                // as well as the origin the the object
                e.Options.Payload = draggedItem.DataContext;

                //e.Source = this;
                //e.Handled = true;
            }
            // Ask if it is OK to drop the target at the particular location
            if (e.Options.Status == DragStatus.DropSourceQuery)
            {
                e.QueryResult = true;
                e.Handled     = true;
            }
        }
Beispiel #25
0
 // OnDropQuery event handler
 private void OnDropQuery(object sender, DragDropQueryEventArgs e)
 {
     //var draggedItems = e.Options.Payload as ICollection;
     e.QueryResult = true;
     e.Handled = true;
 }
Beispiel #26
0
 // OnDragQuery event handler
 private void OnDragQuery(object sender, DragDropQueryEventArgs e)
 {
     e.QueryResult = true;
     e.Handled = true;
 }
 private void ExecuteDragQueryCommand( DragDropQueryEventArgs obj )
 {
     var dragItem = obj.Options.Payload as ProgramEnrollmentDto;
     if ( dragItem != null )
     {
         obj.QueryResult = dragItem.IsActive;
     }
 }
Beispiel #28
0
 private void OnDragQuery(object sender, DragDropQueryEventArgs e)
 {
     if ( e.Options.Status == DragStatus.DragQuery )
     {
         e.Options.Payload = _resultsGrid.SelectedItem;
         if ( DragStartingCommand != null )
         {
             DragStartingCommand.Execute ( e );
         }
         var cue = new Border ();
         cue.Style = Application.Current.Resources["DragBorderStyle"] as Style;
         var content = new ContentControl ();
         content.ContentTemplate = ResultTemplates.Count > 0 ? ResultTemplates[0] : null;
         content.Content = _resultsGrid.SelectedItem;
         cue.Child = content;
         e.Options.DragCue = cue;
         RadDragAndDropManager.DragCueOffset = GetEffectiveDragOffset ( e.Options );
         QuickSearchText = string.Empty;
         ExecuteCloseCommand ();
         SelectedResult = _resultsGrid.SelectedItem;
     }
     e.QueryResult = true;
 }
 /// <summary>
 /// Validate Drag/Drop events for the curriculum tree
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OnDropInsideTreeViewDropQuery(object sender, DragDropQueryEventArgs e)
 {
     try
     {
         var treeViewItem = e.Options.Destination as RadTreeViewItem;
         if (treeViewItem.DropPosition != DropPosition.Inside)
         {
             e.QueryResult = false;
         }
         else
         {
             //Don't allow courses to be dropped into other curriculum items
             if (e.OriginalSource.ToString() == "lbcLibrary.Course")
             {
                 e.QueryResult = false;
             }
             //Only allow units to be dropped into courses
             else if (e.OriginalSource.ToString() == "lbcLibrary.Unit" && e.Options.Destination.ToString() != "lbcLibrary.Course")
             {
                 e.QueryResult = false;
             }
             //Only allow lessons to be dropped into units
             else if (e.OriginalSource.ToString() == "lbcLibrary.Lesson" && e.Options.Destination.ToString() != "lbcLibrary.Unit")
             {
                 e.QueryResult = false;
             }
         }
     }
     catch
     {
         //Fail Silently
     }
 }
 private void ExecuteDragQueryCommand( DragDropQueryEventArgs obj )
 {
     var dragItem = obj.Options.Payload as ProblemDto;
     if ( dragItem != null )
     {
         obj.QueryResult = dragItem.ProblemStatus.WellKnownName == ProblemStatus.Active;
     }
 }
Beispiel #31
0
        /// <summary>
        /// 处理拖拽的拖动操作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UserInRoles_OnDragQuery(object sender, DragDropQueryEventArgs e)
        {
            RadGridView gridView = sender as RadGridView;
            if (gridView != null)
            {
                IList selectedItems = gridView.SelectedItems.ToList();
                e.QueryResult = selectedItems.Count > 0 && (selectedItems[0] as UserInRole).Users.UserName != "admin";
                e.Options.Payload = selectedItems;
                if (selectedItems.Count > 0 && (selectedItems[0] as UserInRole).Users.UserName == "admin")
                {
                    MessageEventAggregatorRepository.EventAggregator.Publish<MessageEvent>(new MessageEvent { Message = "admin用户不能删除用户角色!", MessageType = MessageType.Info });
                }

            }
            else
                e.QueryResult = false;
            e.Handled = true;
        }
Beispiel #32
0
 /// <summary>
 /// 处理拖拽的释放操作
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Roles_OnDropQuery(object sender, DragDropQueryEventArgs e)
 {
     bool result = true;
     var draggedItems = e.Options.Payload as List<object>;
     if (draggedItems != null && draggedItems[0].GetType() != typeof(UserInRole))
     {
         result = false;
         this.dropImpossibleReason = string.Empty;
     }
     e.QueryResult = result;
     e.Handled = true;
 }
Beispiel #33
0
 /// <summary>
 /// 处理拖拽的拖动操作
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Roles_OnDragQuery(object sender, DragDropQueryEventArgs e)
 {
     RadGridView gridView = sender as RadGridView;
     if (gridView != null)
     {
         IList selectedItems = gridView.SelectedItems.ToList();
         e.QueryResult = selectedItems.Count > 0;
         e.Options.Payload = selectedItems;
     }
     else
         e.QueryResult = false;
     e.Handled = true;
 }
Beispiel #34
0
		private void OnDragQuery(object sender, DragDropQueryEventArgs e)
		{
			if (e.Options.Status == DragStatus.DragQuery)
			{
				e.QueryResult = true;
				e.Handled = true;

				var sourceControl = e.Options.Source;

				var dragCue = RadDragAndDropManager.GenerateVisualCue(sourceControl);
				dragCue.HorizontalAlignment = HorizontalAlignment.Left;
				dragCue.Content = sourceControl.DataContext;
                dragCue.ContentTemplate = App.Current.Resources["TrackDragCueTemplate"] as DataTemplate;
                dragCue.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Stretch;
				e.Options.DragCue = dragCue;

				e.Options.Payload = new DragDropOperation() { Payload = sourceControl.DataContext };
			}

			if (e.Options.Status == DragStatus.DropSourceQuery)
			{
				e.QueryResult = true;
				e.Handled = true;
			}
		}
 private void ExecuteDragQuery(DragDropQueryEventArgs obj)
 {
     var dragItem = obj.Options.Payload as DirectMailDto;
     if (dragItem != null)
     {
         obj.QueryResult = true;
     }
 }
Beispiel #36
0
 private void ExecuteDropQueryCommand( DragDropQueryEventArgs obj )
 {
     var result = false;
     if ( obj.Options.Payload is ProblemDto )
     {
         var problemDto = obj.Options.Payload as ProblemDto;
         var probQuery =
             ProblemList.FirstOrDefault (
                 d => d.ProblemCodeCodedConcept.CodedConceptCode == problemDto.ProblemCodeCodedConcept.CodedConceptCode );
         result = probQuery == null;
     }
     obj.QueryResult = result;
 }
Beispiel #37
0
        //These two methods are needed to make Drag and Drop work, but they simply tell the DragDropManager that a drag and drop are possible
        #region Drag/Drop Query

        private void OnDropQuery(object sender, DragDropQueryEventArgs e)
        {
            if (CheckSourceForHeaderCell(e.Options.Source))
                return;

            e.QueryResult = true;
            e.Handled = true;
        }
Beispiel #38
0
        private void OnDragQuery(object sender, DragDropQueryEventArgs e)
        {
            if (CheckSourceForHeaderCell(e.Options.Source))
                return;

            e.QueryResult = false;

            var gridView = ((TaskBoard)sender).PublicTaskBoardRadGridView;

            if (gridView != null)
            {
                IList selectedItems = gridView.SelectedItems.ToList();

                //Will return true if the number of selected tasks is more than 0
                e.QueryResult = selectedItems.Count > 0;

                e.Options.Payload = selectedItems;
            }

            e.Handled = true;
        }
Beispiel #39
0
 /// <summary>
 /// 处理拖拽的释放操作
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void UserInRoles_OnDropQuery(object sender, DragDropQueryEventArgs e)
 {
     bool result = true;
     var draggedItems = e.Options.Payload as List<object>;
     if (draggedItems != null)
     {
         Roles selrole = draggedItems[0] as Roles;
         // 控制是否可以释放,添加不可释放的原因。
         if (SelCurrentUser == null)
         {
             result = false;
             this.dropImpossibleReason = "没有选中的用户";
         }
         if (selrole != null && (SelCurrentUser.UserInRoles.Any(p => p.Roles == selrole)))
         {
             result = false;
             this.dropImpossibleReason = "当前用户此角色已存在!";
         }
         else if (draggedItems != null && draggedItems[0].GetType() == typeof(UserInRole))
         {
             result = false;
             this.dropImpossibleReason = string.Empty;
         }
     }
     e.QueryResult = result;
     e.Handled = true;
 }
Beispiel #40
0
		private void OnDropQuery(object sender, DragDropQueryEventArgs e)
		{
			if (e.Options.Status == DragStatus.DropDestinationQuery)
			{
				var destination = e.Options.Destination;
				var listBox = destination.FindItemsConrolParent() as ListBox;

				//Cannot place na item relative to itself:
				if (e.Options.Source == e.Options.Destination)
				{
					return;
				}

				VisualStateManager.GoToState(listBox, "DropPossible", false);

				//Get the spacial relation between the destination item and the vis. root:
				var destinationTopLeft = destination.TransformToVisual(null).Transform(new Point());

				//Should the new Item be moved before or after the destination item?:
				bool placeBefore = (e.Options.CurrentDragPoint.Y - destinationTopLeft.Y) < destination.ActualHeight / 2;

				var operation = e.Options.Payload as DragDropOperation;

				operation.DropPosition = placeBefore ? DropPosition.Before : DropPosition.After;

				e.QueryResult = true;
				e.Handled = true;
			}
		}
        private void ExecuteDropQueryCommand(DragDropQueryEventArgs obj)
        {
            var directMail = obj.Options.Payload as DirectMailDto;

            if (directMail == null)
            {
                return;
            }

            _navigationService.Navigate (
                RegionManager,
                "WorkspaceContentScopedRegion",
                ExternalPatientHistoryView,
                null,
                new[]
                    {
                        new KeyValuePair<string, string> ( "PatientKey", _patientKey.ToString () ),
                        new KeyValuePair<string, string> ( "MailId", directMail.Id.ToString () ),
                        new KeyValuePair<string, string> ( "MailFolderName", directMail.FolderName ),
                        new KeyValuePair<string, string> ("AttachmentName", directMail.AttachmentName),
                        new KeyValuePair<string, string> ( "MailFromName", string.IsNullOrWhiteSpace ( directMail.FromName ) ? directMail.From : directMail.FromName ),
                    } );
        }