Esempio n. 1
0
        public DragStartingEventArgs SendDragStarting(IView element)
        {
            var args = new DragStartingEventArgs();

            DragStartingCommand?.Execute(DragStartingCommandParameter);
            DragStarting?.Invoke(this, args);

            if (!args.Handled)
            {
                args.Data.PropertiesInternal.Add("DragSource", element);
            }

            if (args.Cancel || args.Handled)
            {
                return(args);
            }

            _isDragActive = true;

            if (args.Data.Image == null && element is IImageElement ie)
            {
                args.Data.Image = ie.Source;
            }

            if (String.IsNullOrWhiteSpace(args.Data.Text))
            {
                args.Data.Text = element.GetStringValue();
            }

            return(args);
        }
Esempio n. 2
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;
 }