コード例 #1
0
ファイル: MainPage.xaml.cs プロジェクト: de1mos242/Jukebox
        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;
            }
        }
コード例 #2
0
ファイル: DragBehavior.cs プロジェクト: girish66/REM
        /// <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;
            }
        }