Silverlight 2.0 RC Drag and Drop ListBox List

I am trying to provide a ListBox drag and drop ordering function and I hit a wall. I got it to work when I specify list items in xaml, but it does not work when I bind to a list that no longer works, because the elements are no longer of type listboxitem.

I found this code http://blog.dobaginski.com/josh/?p=52 , which allows me to get the base ListBoxItem, but I can not get the mouse move to fire event.

I went through other tutorials but couldn't find the one that deals with ListBox. Has anyone done this using a ListBox.

The events I use are SelectedChange, MouseMove, and LeftMouseButtonUp (I think this name is correct). I do not use LeftMouseButtonDown because I could not start it.

+4
source share
3 answers

As far as I know, you cannot get into the container of a list item when using data binding. You can in beta 1.

You also cannot set the mouse event handler in the style, you must use the data template so that you know.

You will probably have to use the mouse move event from the parent element, perhaps the UserControl control or the main layout in which the list is located.

State changes and animations should be in style, though so ... you still cannot get the list item, only the item inside it in the data template.

Oh, and if you drag and drop, HitTest will now be protected to make Drop harder.

+1
source

since today you can download the latest version of Silverlight with some add-ons, check out Scott's weblog

+1
source

I am trying to do the same in WPF, but found only a lot of errors.

One person directed me to the Beatrice Costa blog, and from what I remember, she is one of those rare geniuses, so I suggest you read this as well ... I know that I will

Beatrice Costa Blog

+1
source

Source: https://habr.com/ru/post/1277593/


All Articles