﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - ClientUI - UXListBox DragEvent</title><link>http://www.intersoftsolutions.com/Community/ClientUI/UXListBox-DragEvent/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>UXListBox DragEvent</title><link>http://www.intersoftsolutions.com/Community/ClientUI/UXListBox-DragEvent/</link><pubDate>Fri, 14 Jan 2011 10:19:08 GMT</pubDate><dc:creator>rasmister</dc:creator><description>&lt;p&gt;Andry,&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;That's great, thank you all!&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Ross&lt;/p&gt;</description></item><item><title>UXListBox DragEvent</title><link>http://www.intersoftsolutions.com/Community/ClientUI/UXListBox-DragEvent/</link><pubDate>Fri, 14 Jan 2011 04:10:30 GMT</pubDate><dc:creator>ansoesil</dc:creator><description>&lt;p&gt;Hi Ross,&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Your request to have property that populated with collection of drop items before its processed is actually a good idea to accomodate common practice in MVVM concept. Therefore the development team already put this request in high priority enhancement that you can get in the next hotfix.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;So in a glance the new property that you can listen to is DropItems. This DropItems property will be populated right before the internal process to update the collection, and will be resetted after ward.&lt;/p&gt;
&lt;p&gt;In your VIewModel, you need to have something like:&lt;/p&gt;&lt;pre&gt;        public ObservableCollection&amp;lt;object&amp;gt; DropItems
        {
            get
            {
                return this._dropItems;
            }
            set
            {
                if (this._dropItems != value)
                {
                    this._dropItems = value;

                    if (this._dropItems != null)
                    {
                        Data data = this._dropItems[0] as Data;
                        data.Property1 = "new string";

                        // you can also clear the items if needed
                        // this._dropItems.Clear();
                    }

                    this.OnPropertyChanged("DropItems");
                }
            }
        }&lt;/pre&gt;
&lt;p&gt;Will notify you again when the hotfix is available.&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Andry&lt;/p&gt;</description></item><item><title>UXListBox DragEvent</title><link>http://www.intersoftsolutions.com/Community/ClientUI/UXListBox-DragEvent/</link><pubDate>Wed, 12 Jan 2011 09:03:57 GMT</pubDate><dc:creator>rasmister</dc:creator><description>&lt;p&gt;Andry,&lt;/p&gt;
&lt;p&gt;Your last paragraph is how I solved it in MVVM.  It would be handy however to have a property that fired BEFORE the collection was modified so we can intercept it.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Ross&lt;/p&gt;</description></item><item><title>UXListBox DragEvent</title><link>http://www.intersoftsolutions.com/Community/ClientUI/UXListBox-DragEvent/</link><pubDate>Tue, 11 Jan 2011 22:35:24 GMT</pubDate><dc:creator>ansoesil</dc:creator><description>&lt;p&gt;Drop event is considered interaction in View, so you need to attached Drop event handler at UXListBox and handle it in the View if you want to intercept the drop event.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;You can declare the event handler directly in XAML.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre&gt;&amp;lt;Intersoft:UXListBox x:Name="lbMyMemberships" Drop="lbMyMemberships_Drop"&amp;gt;

 
&lt;/pre&gt;

&lt;p&gt;And handle it at code behind.&lt;/p&gt;&lt;pre&gt;using Intersoft.Client.UI.Controls.Interactivity;

private void lbMyMemberships_Drop(object sender, Intersoft.Client.UI.Controls.Interactivity.DragEventArgs e)
{
        UIElement sourceElement = e.GetSourceElement();
        IList&amp;lt;UIElement&amp;gt; dropElements = e.GetDropElements();

 // to do
}&lt;/pre&gt;

&lt;p&gt;Note that the e.GetSourceElement() , e.GetDropElements() and some other methods are extensions method. You need to import the Intersoft.Client.UI.Controls.Interactivity namespace.&lt;/p&gt;
&lt;p&gt;Besides using direct event handler in XAML you can also handle it using EventManager. The Drop event and other related drag drop event is a routed event handler.&lt;/p&gt;&lt;pre&gt;public MainPage()
{
    // Required to initialize variables
    InitializeComponent();

    ISEventManager.RegisterInstanceHandler(
        this.LayoutRoot, // any element in the routed path which applicable in your scenario
        DragDrop.DropEvent, // the routed event
        new Intersoft.Client.UI.Controls.Interactivity.DragEventHandler(lbMyMemberships_Drop), // the event handler
        true);
}

private void lbMyMemberships_Drop(object sender, Intersoft.Client.UI.Controls.Interactivity.DragEventArgs e)
{
        UIElement sourceElement = e.GetSourceElement();
        IList&amp;lt;UIElement&amp;gt; dropElements = e.GetDropElements();

 // to do
}
&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;To learn more about handling routed events, see &lt;a href="http://intersoftpt.com/Support/ClientUI/Docs/RoutedEventsOverview.html" target="_blank"&gt;http://intersoftpt.com/Support/ClientUI/Docs/RoutedEventsOverview.html&lt;/a&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Another perspective for this matter is intercepting the "Drop Event" in ViewModel. However this is limited to changes in data. For example if you drag an item from another UXListBox to this UXListBox, the itemsource collection will be changed. Therefore you can add CollectionChanged event handler at your ItemsSource collection in ViewModel and do additional tasks in that event handler.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Hope this helps&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Andry&lt;/p&gt;</description></item><item><title>UXListBox DragEvent</title><link>http://www.intersoftsolutions.com/Community/ClientUI/UXListBox-DragEvent/</link><pubDate>Tue, 11 Jan 2011 16:09:52 GMT</pubDate><dc:creator>rasmister</dc:creator><description>&lt;p&gt;After reviewing the documentation, I was still unclear how I could intercept a Drop event in an MVVM environment.  Does anyone know how this can be done?  Below is my UXListBox.&lt;/p&gt;
&lt;p /&gt;
&lt;p&gt;                    &amp;lt;Intersoft:UXListBox x:Name="lbMyMemberships" ItemsSource="{Binding OCMyMemberships, Mode=TwoWay}" SelectedItem="{Binding CurrentMyMemberships, Mode=TwoWay}" Margin="2" Height="331" ImageMemberPath="IconName" DisplayMemberPath="Description" AllowDropItem="True" AllowMoveItem="True" AllowRemoveItem="False" ItemContentType="ContentAndImage" ItemImageHeight="32" ItemImageWidth="32" ItemImageStretch="Fill" Style="{StaticResource UXListBoxTransparentStyle}" &amp;gt;&lt;/p&gt;
&lt;p&gt;                        &amp;lt;i:Interaction.Behaviors&amp;gt;&lt;/p&gt;
&lt;p&gt;                            &amp;lt;Intersoft:DropTargetBehavior AllowDropItem="True"/&amp;gt;&lt;/p&gt;
&lt;p&gt;                        &amp;lt;/i:Interaction.Behaviors&amp;gt;&lt;/p&gt;
&lt;p&gt;                    &amp;lt;/Intersoft:UXListBox&amp;gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Ross&lt;/p&gt;
&lt;/div&gt;
&lt;p /&gt;</description></item></channel></rss>