Silverlight, Drag and Drop Manager »

[16 Sep 2009 | 0 Comments]

Quick update: I’ve registered my Silverlight Drag and Drop Manager for the Silverlight Control Builder Contest, and it’s been accepted!  :-)  Check out all the entries here.

 

Entry deadline is September 19th, so I suppose I’ll know soon enough how it compares to the other entries.  I, for one, am quite curious about what the judges have to say about it – no matter where it ends in the contest, it’ll probably get me some tips and advice on what can be improved for future releases. 

 

Of course, I’ll keep you all updated!

Silverlight, Drag and Drop Manager »

[10 Sep 2009 | 0 Comments]

A new version of my open source project, the Silverlight Drag and Drop Manager, has just been released on CodePlex.

 

This is a major release, including various bugfixes, performance enhancements and loads of new features, including the ability to customize the return & switch-animations with easing & duration, the ability to customize the DropBorderBrush, a DropMode-property defining what should happen when you drop a DragSource, an AllowAnyDropTarget-property (so you don't have to manually add a list of valid DropTargets for each DragSource), a DragHandleMode-property, and many more.

 

Version 2.0 comes in 2 flavours: binaries for SL2 and binaries for SL3, including an updated sample application in the SL3 version.  If possible, I'd advise you to use SL3 (it allows for easing animations with the Drag and Drop manager), but if you've still got a project in SL2 that's been using a previous release of this software, you can safely upgrade.

 

For an all new example application, all the details, downloads, … one stop!

image

A full list of changes can be found on that CodePlex site, but for reference, here’s the list:

On DragSource:

  • Added property: AllDropTargetsValid:
    When this is set to true, all droptargets on the page will be valid for this dragsource.  The droptarget-list-property will effectively be ignored when this is set to true (default: false)
  • Added property: AutoFitGhost:
    Determines wether or not to auto-fit the ghost control.  It this is true, the ghost (if available) will be resized to match the content (default: false)
  • Added property: DragHandleMode:
    This property determines how you can drag your dragsource around: by using a draghandle (a bar on top of your dragsource), or without one, meaning you can drag by clicking anywhere in the dragsource
  • Added property: DropMode:
    Determines the behaviour when a dragsource is dropped, and the drop is valid: by default, the dragsource is dropped on the droptarget.  If you set DropMode to "ReturnDragSource", the dragsource is returned to where it originated from.  This mode can be useful if you just want to execute some code on dropping (dragsourcedropped event on droptarget is triggered and can be handled if you add a handler to it), but you do not want the dragsource to be removed from the originating collection.
  • Added property: ReturnAnimationDuration:
    Determines the length of the animation shown when returning a DragSource to its original position (default: 0.2)
  • Added property: ReturnAnimationEasingFunction:
    Determines the easing function of the animation shown when returning a DragSource to its original position (default: none, Silverlight 3 (or higher) required)
  • Added property: SwitchAnimationDuration:
    Determines the length of the animation shown when switching 2 DragSources (default: 0.2)
  • Added property: SwitchAnimationEasingFunction:
    Determines the easing function of the animation shown when switching 2 DragSources (default: none, Silverlight 3 (or higher) required)
  • Changed property: GhostVisibility:
    Changed ShowGhost (bool) to GhostVisibility (Visibility).  Determines wether or not the ghost control should be shown (default: Visible)

On DropTarget:

  • Added property: AllowPositionSave
    Determines wether or not the position of a droptarget should be saved.  Setting this option to true results in a significant increase in performance: in regular mode (when this property is false), droptarget positioning is calculated on the fly while dragging a dragsource.  When this is set to true, it's only calculated when the droptarget is loaded.  Do keep in mind that setting this to true will result in strange behaviour if the droptarget hasn't got a fixed position on screen (eg: when the droptarget itself can be moved around).   However, you can recalculate this position by hand by calling the "RecalculatePosition"-method on  the droptarget!  This option is advised when you have lots and lots of droptargets on one screen - in other cases, it shouldn't be necessary.
  • Added property: DropBorderBrush:
    The brush for the drop border
  • Added property: DropBorderCornerRadius:
    The cornerradius of the drop border
  • Added property: DropBorderThickness:
    The thickness of the drop border
  • Changed property: GhostVisibility:
    Changed ShowGhost (bool) to GhostVisibility (Visibility).  Determines wether or not the ghost control should be shown (default: Visible)

Bugfixes:

  • Extra checks to make sure all borders are removed when hovering is stopped - in some cases, the drop target would stay in "hovered"-mode even after the drag source had been dropped.
  • Sometimes, the animation used when switching 2 elements' position would let the elements go "underneath" other elements on the page.  This is now fixed, moving elements are always on top.
  • When clicking an element to start dragging, you'd sometimes loose the ability to drag.  This shouldn't happen anymore.
  • Various other small (performance) improvements and bugfixes.

General, WCF RIA Services, BESUG, Drag and Drop Manager »

[7 Sep 2009 | 0 Comments]

So, the holiday season is over for most of us, I hope everyone had a nice few weeks off – I know I had :-) 

 

Time to get back on track!  Quite a few things are coming up in the next days/weeks/months: a new version of the Silverlight Drag and Drop Manager is coming up (watch this space!), and one of my projects @ work is going live – it’s a showcase site, built completely in Silverlight 3; I’ll share the URL shortly.

 

Next to that, my company is hosting a session I’m doing for BESUG, the Belgian Silverlight User Group shortly, about Silverlight 3 & RIA Services.  If you’d like to be at this session, click here to register.  I’ll share the slides & code on this blog after the session.

 

And last but not least, I’m continuing work on a Silverlight book (more details later) I’m writing together with a collegue, Gill Cleeren.

 

I tend to post updates concerning these things on Twitter, so if you’d like to, you can follow me here (@KevinDockx).

 

To sum it all up: lots of work to do, guess I won’t have time to get bored the next few months ;-)

Drag and Drop Manager, CodePlex, Silverlight »

[26 Feb 2009 | 5 Comments]

A few weeks ago, I started thinking about designing custom controls for Silverlight, controls I could re-use in various projects.  Instead of just playing around, I figured I might as well make something I could put to use.  Seeing I didn’t find a true, free drag ‘n drop control, I decided to make one myself.

That little project evolved into a drag and drop manager for Silverlight.  There’s still room for improvement, but I’m quite happy with where the project is at at the moment.  And because other people might be able to use a control like this, I decided to make a Codeplex project, so everyone can get this control for free, including sourcecode! :-) 

For those of you who don’t want to read the rest, here’s the link to Drag and Drop Manager @ Codeplex.  And of course, an online sample!

 

The Silverlight Drag And Drop Manager consists of 2 controls (and their corresponding event argument classes): *DragSource* & *DropTarget*.  The first one makes any control draggable: just add the control (and if you wish, a ghost for that control) as the Content-property of the DragSource. 

The DropTarget defines a place in your application where you can drop your DragSources.  Every DragSource has a list of DropTargets on which it can be dropped, thus defining the possible DropTargets for a DragSource.  On the other hand, every DropTarget has a Content-property, which can contain anything that's a DragSource (assuming the correct rights).

Typically, you'd create a list of DropTargets & a list of DragSources on screen if you want to be able to drag those DragSources into your DropTargets.  If you want to have two lists, and want to be able to drag the DragSources back to their original position, you 'd create a list of empty DropTargets, and a list of DropTargets with DragSources as their Content.

Both controls can be added to your Silverlight-app using CodeBehind or using XAML notation.  They both expose different events you can bind handlers to, if needed, eg: DragSourceDropped-event, DropTargetEntered event, et cetera.

Next to that, both controls are *highly configurable*, so lots of possible scenarios are available.  Have a look at the sample application to see a few of them in action! 

 

Full sourcecode, documentation, online sample & binary: Drag and Drop Manager.

Comments are welcome, discussions, feature requests, bug reports, …  can be reported @ Codeplex.

Enjoy! :-)