Since Q3 2011 we have changed the default drag API used. It allows creating more complex scenario as well as building MVVM friendly drag behaviors. However, it does not support drag arrow which, although not very popular feature is still used. Thus, when arrow was required, we have suggesting using legacy execution mechanism.

In this blog I will write how to create your own drag arrow using DragDropManager events. So, basically we will use AddDragInitialize, GiveFeedback and DragDropCompleted to create and control the arrow. We also use Popup to display it on the screen.

The arrow itself is located in Arrow class which derives from Content control and has its own template defined. Thus you can create custom arrow by simply adding new style to this control.

 

So, in order to use it you can just add the following lines in your code:

- Initialize ArrowService:

private void Application_Startup(object sender, StartupEventArgs e) 

{ 
     this.RootVisual = new MainPage();
     ArrowService.Initialize(this.RootVisual);
} 
- Enable Arrow on drag:
ArrowService.DisplayDragArrow = true;
 

That way you have full control of arrow appearance and behavior. I hope you’ll like it.

Download Silverlight project

About the Author

Tsvyatko Konov

is software developer in Telerik Windows 8 product team. You can follow him on Twitter @tsvyatco and his personal blog at www.konov.me

Comments

Comments are disabled in preview mode.