Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
200
Dragging/dropping a new tile from a list box to specific place
posted

I need develop functionality to add a new tile to the tilepanel by dragging/dropping from a list box to specific place (between existing tiles) . Would be nice to highlight place of potential drop.  Any good code example. I guess it should be very common.

Parents
No Data
Reply
  • 4850
    Offline posted

    What you are describing is doable but not that trivial. Doing a hittest to determine what tile the mouse is over is not difficult. e.g:

     IInputElement mouseOverElement = Mouse.DirectlyOver;

     Tile tile = Utilities.GetAncestorFromType(mouseOverElement as DependencyObject, typeof(Tile), true, tc) as Tile;

     

     

    Then you could insert your new item into the list at that point.

    However, if the mouse is between tiles (e.g. if there is some spacing) it is not that easy to determine where you should insert the item. It depends on the layout specified for the tiles.

Children