Ejemplo n.º 1
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;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Called when [drag info].
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="Telerik.Windows.Controls.DragDrop.DragDropEventArgs"/> instance containing the event data.</param>
        protected virtual void OnDragInfo(object sender, DragDropEventArgs e)
        {
            e.Handled = true;

            if (e.Options.Status == DragStatus.DragInProgress)
            {
                var cue = RadDragAndDropManager.GenerateVisualCue();
                cue.Content = e.Options.Payload;
                if (DragContentTemplate != null)
                {
                    cue.ContentTemplate = DragContentTemplate;
                }
                e.Options.DragCue = cue;
            }
        }