This is a migrated thread and some comments may be shown as answers.

Random Drag error?

3 Answers 55 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Rod Yager
Top achievements
Rank 1
Rod Yager asked on 27 Dec 2010, 04:56 PM
I have code that overrides the default appointment edit behavior on double click and opens a seperate UIElement that overlays the ScheduleView for editing the appointment. When I navigate back (ie. push the scheduleview back into view), I get this error... Interestingly, If I walk it through debug, I don't see the error and everything works as I would expect it to. Note that I am not dragging anythiing. I am just merely double clicking on an appt to launch a new UIElement and then having that UIElement go away to have the error occur.

Object reference not set to an instance of an object.
Details: 
  
System.NullReferenceException: Object reference not set to an instance of an object.
   at Telerik.Windows.Controls.ScheduleViewBase.StartDrag(DragDropQueryEventArgs e, AppointmentItem clickedItem, DragDropState state)
   at Telerik.Windows.Controls.AppointmentItem.OnAppointmentItemsDragQuery(Object sender, DragDropQueryEventArgs e)
   at Telerik.Windows.Controls.DragDrop.DragDropQueryEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at Telerik.Windows.Controls.DragDrop.RadDragAndDropManager.DragDropProvider_DragQuery(Object sender, DragDropQueryEventArgs e)
   at Telerik.Windows.Controls.DragDrop.DragDropProviderBase.RaiseDragQuery()
   at Telerik.Windows.Controls.DragDrop.WPFSimulatedDragDropProvider.TryStartDrag(IMouseEventArgs e)
   at Telerik.Windows.Controls.DragDrop.SimulatedDragDropProvider.OnTrackedElementMouseMoveInternal(IMouseEventArgs e)
   at Telerik.Windows.Controls.DragDrop.SimulatedDragDropProvider.OnCoverRectangleMouseMoveInternal(IMouseEventArgs e)
   at Telerik.Windows.Controls.DragDrop.WPFSimulatedDragDropProvider.OnCoverRectangleMouseMove(Object sender, MouseEventArgs e)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.ContentElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.MouseDevice.Synchronize()
   at System.Windows.Input.MouseDevice.ChangeMouseCapture(IInputElement mouseCapture, IMouseInputProvider providerCapture, CaptureMode captureMode, Int32 timestamp)
   at System.Windows.Input.MouseDevice.Capture(IInputElement element, CaptureMode captureMode)
   at System.Windows.Input.Mouse.Capture(IInputElement element)
   at System.Windows.Documents.Hyperlink.OnMouseLeftButtonDown(Object sender, MouseButtonEventArgs e)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.ContentElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run()
   at Metrix.UI.App.Main() in C:\Users\rodneyy\Documents\Visual Studio 2010\Projects\M530\Client\Metrix.UI\obj\Debug\App.g.cs:line 0
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

3 Answers, 1 is accepted

Sort by
0
Rosi
Telerik team
answered on 03 Jan 2011, 08:56 AM
Hello Rod Yager,

Is the scheduleview in your application hosted in windows forms application? Could you prepare a sample project  or  send us a short movie illustrating the error?

Also, I suggest you try our latest internal build and let us known whether this helps.

Greetings,
Rosi
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
0
Rod Yager
Top achievements
Rank 1
answered on 03 Jan 2011, 07:29 PM
No it is not hosted in a Windows Form application. It is in a standalone WPF application. I tried installing and using the latest internal build only to find that it has broken other code that I have done. Not sure how to use the SchedulerDragDropPayload now. I was overidding that for my delayed drag drop function that Telerik provided a sample for. Seems that now the SchedulerDragDropPayload takes 1-2 arguments and does not contain the property DragDropState. This is where I was storing my listviewitems (datarowsviews) objects that I was dragging. Do you have any internal documentation on how this is supposed to work now?

No longer works?

public class DelayedDragDrop : SchedulerDragDropPayload
    {
        public Action DragAction
        {
            get;
            set;
        }
        public Action DropAction
        {
            get;
            set;
        }
    }
SchedulerDragVisualCue cue = new SchedulerDragVisualCue();
                cue.HorizontalContentAlignment = HorizontalAlignment.Left;
                cue.VerticalContentAlignment = VerticalAlignment.Top;
                cue.Content = canvas;
                e.Options.DragCue = cue;
  
                DelayedDragDrop payload = new DelayedDragDrop()
                {
                    DragDropState = myScheduleView.GetDragDropStateForDrag(appointments)
                };
  
                payload.DragDropState.Data = listView.SelectedItems;
  
                // Set the payload (this is the item that is currently dragged)
                e.Options.Payload = payload;
                e.QueryResult = myScheduleView.BeginDrag(payload);


0
Rosi
Telerik team
answered on 07 Jan 2011, 09:11 AM
Hello Rod Yager,

We introduced some changes in the of the Drag and Drop functionality of RadScheduleView.We are sorry for the inconvenience that this causes to you. Soon we will update our online examples and documentation where the changes will be described.

With the changed functionality you can use the code below to storage the items:
var cue = new ContentControl();
               cue.HorizontalContentAlignment = HorizontalAlignment.Left;
               cue.VerticalContentAlignment = VerticalAlignment.Top;
               cue.Content = canvas;
               e.Options.DragCue = cue;
               e.Options.Payload = new SchedulerDragDropPayload(listbox.Items, appointments);
               e.QueryResult = true;

As for the problem with the drag error-  we will be happy to help you ,but we need more details or sample running project to isolate the problem.Is it possible to prepare sample application that illustrates the error and send it to us?

Kind regards,
Rosi
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
Tags
ScheduleView
Asked by
Rod Yager
Top achievements
Rank 1
Answers by
Rosi
Telerik team
Rod Yager
Top achievements
Rank 1
Share this question
or