This is a migrated thread and some comments may be shown as answers.
Hide drag visual
2 Answers 40 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Andrew asked on 20 Apr 2012, 05:35 PM
I'd like to hide the drag visual. (See attached image.) How do I do this?

I've tried this:

        <!-- ... -->
        <Style TargetType="telerik:DragVisual">
            <Setter Property="Template">
                    <ControlTemplate TargetType="telerik:DragVisual">
                        <Grid />

I also tried using a Setter for Visibility with a value of Collapsed, instead of setting the Template property.

In both cases, I'm getting a KeyNotFoundException inside a XamlParseException. If I comment out the DragVisualStyle, then I don't get the error.

XamlParseException: [Line: 0 Position: 0]
   at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
   at MS.Internal.XcpImports.SetValue(IManagedPeerBase obj, DependencyProperty property, DependencyObject doh)
   at System.Windows.DependencyObject.SetValue(DependencyProperty property, DependencyObject doh)
   at System.Windows.FrameworkElement.set_Style(Style value)
   at Telerik.Windows.Controls.DragDropHelper.CreateDefaultDragVisual(IEnumerable`1 draggedAppointments)
   at Telerik.Windows.Controls.DragDropHelper.CreateDragVisualFullTrust(IPayload payload, Double& offsetLeft, Double& offsetTop)
   at Telerik.Windows.Controls.DragDropHelper.CreateDragVisual(IPayload payload, Double& offsetLeft, Double& offsetTop)
   at Telerik.Windows.Controls.DragDropHelper.OnDragInitialize(Object sender, DragInitializeEventArgs e)
   at Telerik.Windows.DragDrop.DragInitializeEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at Telerik.Windows.RadRoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at Telerik.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RadRoutedEventArgs routedEventArgs)
   at Telerik.Windows.RouteItem.InvokeHandler(RadRoutedEventArgs routedEventArgs)
   at Telerik.Windows.EventRoute.InvokeHandlersImpl(Object source, RadRoutedEventArgs args, Boolean raisedAgain)
   at Telerik.Windows.EventRoute.InvokeHandlers(Object source, RadRoutedEventArgs args)
   at Telerik.Windows.RadRoutedEventHelper.RaiseEvent(DependencyObject element, RadRoutedEventArgs args)
   at Telerik.Windows.DependencyObjectExtensions.RaiseEvent(DependencyObject element, RadRoutedEventArgs e)
   at Telerik.Windows.DragDrop.DragInitializer.StartDrag()
   at Telerik.Windows.DragDrop.DragInitializer.StartDragPrivate(UIElement sender)
   at Telerik.Windows.DragDrop.DragInitializer.DragSourcePreviewMouseMove(Object sender, MouseEventArgs e)
   at MS.Internal.CoreInvokeHandler.InvokeEventHandler(UInt32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName, UInt32 flags)

Inner exception: KeyNotFoundException
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at System.Windows.ResourceManagerWrapper.GetResourceForUri(Uri xamlUri, Type componentType)

2 Answers, 1 is accepted

Sort by
Telerik team
answered on 23 Apr 2012, 11:02 AM
Hello Andrew,

Overriding the ControlTemplate the way you do is the right way to go. The only thing to keep in mind is to target the DragVisual class in the ScheduleView assembly. That is, use the following TargetType:

with the following namespace:

I hope this will be helpful.

the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Top achievements
Rank 1
answered on 23 Apr 2012, 03:11 PM
Hello Dani,

That fixed me right up! In fact, both my solutions now work when I specify the correct namespace for DragVisual. Thanks!

Asked by
Top achievements
Rank 1
Answers by
Telerik team
Top achievements
Rank 1
Share this question