0
votes

Click Here to View ImageI am implementing Drag& Drop in wpf. I want when i dragged ListBoxItem From one Listbox to another. that listboxitem should be visible while dragging.Do i missing Something ?

XAML

<Grid x:Name="MainGrid" Width="{Binding ElementName=ProjectWindow,Path=ActualWidth}" >

    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="19*" />
        <ColumnDefinition Width="283*" />
        <ColumnDefinition Width="59*" />
        <ColumnDefinition Width="19*" />
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
        <RowDefinition  Height="7*" />
        <RowDefinition  Height="83*" />
    </Grid.RowDefinitions>
    <Canvas Grid.Row="0"  >
        <Label Content="TM" FontSize="14" Foreground="White" FontFamily="segoe_uilight" Canvas.Left="118" Canvas.Top="-4"></Label>
        <Label Content="smart" FontSize="26" Foreground="White" FontFamily="segoe_uilight"></Label>
        <Label Content="Project" FontSize="26" Foreground="White" FontFamily="segoe_uilight" Canvas.Left="64" FontWeight="Bold"></Label>
        <TextBlock Canvas.Left="164" Canvas.Top="15" Background="Black">
        <Label Background="Black" Content="From" FontSize="12" Foreground="White" FontFamily="segoe_uilight" Canvas.Left="164" Canvas.Top="15" ></Label>
        <DatePicker x:Name="StartDate" Width="100" Background="Black" Canvas.Left="204" Canvas.Top="15"></DatePicker>
        <Label Background="Black" Content="Till" FontSize="12" Foreground="White" FontFamily="segoe_uilight" Canvas.Left="315" Canvas.Top="15" ></Label>
        <DatePicker x:Name="EndDate" Width="100" Background="Black" Canvas.Left="344" Canvas.Top="15"></DatePicker>
              <Label Background="Black" Content="My Activities" FontSize="12" Foreground="White" FontFamily="segoe_uilight" Canvas.Left="315" Canvas.Top="15" ></Label>
       <CheckBox x:Name="ChckBoxMyActivities" Click="ChckBoxMyActivities_Click_1"  Background="Black" Margin="0,0,0,5" Width="20"></CheckBox>
             <Label Background="Black" Content="Project Component" FontSize="12" Foreground="White" FontFamily="segoe_uilight" Canvas.Left="315" Canvas.Top="15" ></Label>
       <ComboBox x:Name="ComboBoxSubProjects" SelectionChanged="ComboBoxSubProjects_SelectionChanged_1" Background="Black" Margin="0,0,0,5" Width="100" ></ComboBox>
        </TextBlock>
        <Expander HorizontalAlignment="Right" FlowDirection="RightToLeft"  Foreground="White" FontFamily="segoe_uilight"  Width="200px" Canvas.Top="1" Canvas.Right="200"  Canvas.Left="{Binding Source={x:Static SystemParameters.PrimaryScreenWidth}}"  BorderBrush="#FF0A0909" BorderThickness="1,1,1,2" Background="#BF080707" Panel.ZIndex="99999">
            <Expander.Header>
                <StackPanel Orientation="Horizontal">
                    <Canvas Height="22" Width="172px" VerticalAlignment="Bottom">
                        <Label x:Name="LoginUserName" Margin="0px 0 0 0" HorizontalAlignment="Left"   Foreground="White" FontFamily="segoe_uilight" BorderThickness="0"></Label>
                        <Image  Source="img\icons\dropdown_user.png"  Height="20px" Width="20px" RenderTransformOrigin="2.75,0.8" Canvas.Left="117" />
                    </Canvas>
                </StackPanel>
            </Expander.Header>

            <!--<Expander.Content>
            <TextBox Text="LoginUserName"></TextBox>
        </Expander.Content>-->
            <StackPanel Margin="10,4,0,0" >
                <StackPanel Orientation="Horizontal">

                    <Label x:Name="lblSettings" Margin="49px 0 31px 0" HorizontalAlignment="Left"  Content="Settings" Foreground="White" FontFamily="segoe_uilight" BorderThickness="0" RenderTransformOrigin="2.019,0.625">

                    </Label>
                    <Image  Source="img\icons\setting.png" Height="20px" Width="20px" />
                </StackPanel>
                <!--<Label Margin="4" Content="Logout"  />-->
                <!--<Button x:Name="btnLogout" Margin="4" Content="Logout" Click="btnLogout_Click_1"></Button>-->

                <StackPanel Orientation="Horizontal">

                    <Label x:Name="btnLogout" HorizontalAlignment="Left"  Margin="54px 0 31px 0" Content="Logout"  Foreground="White" FontFamily="segoe_uilight" BorderThickness="0">

                    </Label>
                    <Image  Source="img\icons\logout.png" Height="20px" Width="20px"  />
                </StackPanel>
            </StackPanel>
        </Expander>
    </Canvas>
    <Canvas Grid.Column="0" Grid.Row="1" Background="Orange">
        <StackPanel Canvas.Left="10" Background="Gray" Width="60" >

            <Image  Source="img\icons\information.png" Height="20px" Width="20px" />
            <Label   HorizontalAlignment="Center"   Content="Info" Foreground="White" FontFamily="segoe_uilight" BorderThickness="0" >

            </Label>

        </StackPanel>
        <StackPanel Canvas.Left="10" Canvas.Top="45" Background="Gray" Width="60" >
            <Image  Source="img\icons\Scheme.png" Height="20px" Width="20px" />
            <Label   HorizontalAlignment="Center"   Content="Schema" Foreground="White" FontFamily="segoe_uilight" BorderThickness="0" >

            </Label>

        </StackPanel>
        <StackPanel Canvas.Left="10" Canvas.Top="90" Background="Gray" Width="60" >
            <Image  Source="img\icons\Tavala.png" Height="20px" Width="20px" />
            <Label HorizontalAlignment="Center"   Content="Tavla" Foreground="White" FontFamily="segoe_uilight" BorderThickness="0" >

            </Label>

        </StackPanel>
    </Canvas>

    <Canvas x:Name="gd" Grid.Column="1" Grid.Row="1"  Panel.ZIndex="-1" Background="Orange">
        <Grid Width="{Binding ElementName=gd, Path=ActualWidth}" Panel.ZIndex="-1">

            <Grid.RowDefinitions>
                <RowDefinition  />
            </Grid.RowDefinitions>

            <Canvas Grid.Column="1" Grid.Row="0" >
                <Canvas x:Name="MainCanvas" Width="{Binding ElementName=gd,Path=ActualWidth}" >
                    <ListBox Height="{Binding ElementName=gd,Path=ActualHeight}" Width="{Binding ElementName=gd,Path=ActualWidth}" BorderThickness="0" >
                        <ListBoxItem>
                            <ListBox Loaded="icTodoList_Loaded_1" Background="Azure"    SelectionChanged="icTodoList_SelectionChanged_1"   Name="icTodoList"  Height="50" Width="{Binding ElementName=gd,Path=ActualWidth}" >

                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <ListBox x:Name="Phases" BorderThickness="0">
                                            <ListBoxItem>
                                                <Canvas x:Name="PhaseCanvas"  Height="20" Width="200"  Margin="0,0,20,20"  >
                                                    <StackPanel  Orientation="Horizontal">
                                                        <TextBlock x:Name="txtPhaseID" TextAlignment="Center" FontWeight="Light" HorizontalAlignment="Center" FontSize="16" Foreground="Black"  FontFamily="segoe_uilight"  Text="{Binding PhaseTitle}"  Height="20" Width="140"    />
                                                        <Image Margin="20,0,0,0" Tag="{Binding PhaseID}" Source="img\icons\add_btn.png" Width="20" Height="15" MouseUp="Image_MouseUp_1"></Image>
                                                        <!--<TextBlock HorizontalAlignment="Left" FontFamily="segoe_uilight" FontStyle="Italic" Text="{Binding UserName}"  Height="20" Width="180"  />
                                        <TextBlock TextWrapping="Wrap"  HorizontalAlignment="Left" FontFamily="segoe_uilight" Text="{Binding ThreadDescription}" Height="45" Width="200"    />-->
                                                    </StackPanel>
                                                </Canvas>
                                            </ListBoxItem>
                                        </ListBox>
                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                                <ListBox.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <WrapPanel IsItemsHost="True" Orientation="Horizontal"  />
                                    </ItemsPanelTemplate>
                                </ListBox.ItemsPanel>
                            </ListBox>
                        </ListBoxItem>
                        <ListBoxItem>

                            <ListBox Loaded="ActivityListBox_Loaded_1" Background="Orange"   Name="ActivityListBox"  Height="{Binding ElementName=gd,Path=ActualHeight}" Width="{Binding ElementName=gd,Path=ActualWidth}" BorderThickness="0" >

                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <ListBox x:Name="InnerActivityListBox" Tag="{Binding PhaseID}" Width="225" Height="{Binding ElementName=gd,Path=ActualHeight}" Background="Orange"  PreviewMouseLeftButtonDown="InnerActivityListBox_PreviewMouseLeftButtonDown_1" AllowDrop="True" DragEnter="InnerActivityListBox_DragEnter_1" Drop="InnerActivityListBox_Drop_1" DragOver="InnerActivityListBox_DragOver_1" BorderThickness="0">
                                            <!--<ListBoxItem>-->
                                            <!--<Canvas  x:Name="ActivityCanvas" Width="200" Height="70" Background="White" >
                                    <StackPanel  Orientation="Vertical">
                                        <TextBlock HorizontalAlignment="Left"  FontWeight="Bold" Height="70" Width="10"    Background="{Binding ColorDefination}" Margin="0"></TextBlock>
                        <TextBlock  Margin="30,-70,0,0" Text="{Binding ActivityTitle}" FontWeight="Bold"  ></TextBlock>
                                        <TextBlock  Margin="30,-60,0,0" Text="{Binding ProjectComponentTitle}" ></TextBlock>
                                        <TextBlock   Margin="30,-40,0,0" Text="1 Jan-3Mar" ></TextBlock>

                                    </StackPanel>
                                    <StackPanel Orientation="Horizontal" >
                                        <Image Name="imgDesc" MouseUp="imgDesc_MouseUp_1" Source="img/icons/icon.png" Margin="20,50,0,0"  Canvas.Left="15" Canvas.Top="50"></Image>
                                        <Image Name="imgComments" MouseUp="imgComments_MouseUp_1"  Source="img/icons/icon_1.png" Margin="20,50,0,0" Canvas.Left="45" Canvas.Top="50"></Image>
                                        <Image Name="imgMembers" MouseUp="imgMembers_MouseUp_1"  Source="img/icons/icon_2.png" Margin="20,50,0,0"  Canvas.Left="75" Canvas.Top="50"></Image>
                                        <Image Name="imglinks" MouseUp="imglinks_MouseUp_1" Source="img/icons/t3.png" Margin="20,50,0,0" Canvas.Left="105"  Canvas.Top="50"></Image>
                                    </StackPanel>
                                </Canvas>-->
                                            <!--</ListBoxItem>-->
                                        </ListBox>
                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                                <ListBox.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <WrapPanel IsItemsHost="True" Orientation="Horizontal"  />
                                    </ItemsPanelTemplate>
                                </ListBox.ItemsPanel>


                            </ListBox>
                        </ListBoxItem>
                    </ListBox>


                    <!--<ListBox Loaded="ActivityListBox_Loaded_1"    Name="ActivityListBox"  Height="{Binding ElementName=gd,Path=ActualHeight}" Canvas.Top="100" Width="{Binding ElementName=gd,Path=ActualWidth}" Background="Orange">

                        <ListBox.ItemTemplate >
                            <DataTemplate>
                                <ListBox x:Name="InnerActivityListBox">
                                    <ListBoxItem>
                                <Canvas  x:Name="ActivityCanvas" Width="200" Height="70" Background="White" >
                                    <StackPanel  Orientation="Vertical">
                                        <TextBlock HorizontalAlignment="Left"  FontWeight="Bold" Height="70" Width="10"    Background="{Binding ColorDefination}" Margin="0"></TextBlock>
                        <TextBlock  Margin="30,-70,0,0" Text="{Binding ActivityTitle}" FontWeight="Bold"  ></TextBlock>
                                        <TextBlock  Margin="30,-60,0,0" Text="{Binding ProjectComponentTitle}" ></TextBlock>
                                        <TextBlock   Margin="30,-40,0,0" Text="1 Jan-3Mar" ></TextBlock>

                                    </StackPanel>
                                    <StackPanel Orientation="Horizontal" >
                                        <Image Name="imgDesc" MouseUp="imgDesc_MouseUp_1" Source="img/icons/icon.png" Margin="20,50,0,0"  Canvas.Left="15" Canvas.Top="50"></Image>
                                        <Image Name="imgComments" MouseUp="imgComments_MouseUp_1"  Source="img/icons/icon_1.png" Margin="20,50,0,0" Canvas.Left="45" Canvas.Top="50"></Image>
                                        <Image Name="imgMembers" MouseUp="imgMembers_MouseUp_1"  Source="img/icons/icon_2.png" Margin="20,50,0,0"  Canvas.Left="75" Canvas.Top="50"></Image>
                                        <Image Name="imglinks" MouseUp="imglinks_MouseUp_1" Source="img/icons/t3.png" Margin="20,50,0,0" Canvas.Left="105"  Canvas.Top="50"></Image>
                                    </StackPanel>
                                </Canvas>
                                    </ListBoxItem>
                                </ListBox>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                        <ListBox.ItemsPanel>
                            <ItemsPanelTemplate>
                                <WrapPanel IsItemsHost="True" Orientation="Vertical"  />
                            </ItemsPanelTemplate>
                        </ListBox.ItemsPanel>
                    </ListBox>-->


                    <!--<Canvas Width="200" Height="50" Background="White" Canvas.Left="46" Canvas.Top="10">
                        <TextBlock  FontWeight="Bold" Height="50" Width="10"   Canvas.Left="0" Background="Gray"></TextBlock>
                        <TextBlock Text="Header Style" FontWeight="Bold"  Canvas.Top="2" Canvas.Left="15"></TextBlock>
                        <TextBlock Text="Schedule" Canvas.Top="14" Canvas.Left="15"></TextBlock>
                        <TextBlock Text="1 Jan-3Mar" Canvas.Top="7" Canvas.Left="110"></TextBlock>
                        <Image Source="img/icons/icon.png"  Canvas.Left="15" Canvas.Bottom="5"></Image>
                        <Image Source="img/icons/icon_1.png"  Canvas.Left="45" Canvas.Bottom="5"></Image>
                        <Image Source="img/icons/icon_2.png"  Canvas.Left="75" Canvas.Bottom="5"></Image>
                        <Image Source="img/icons/t3.png"  Canvas.Left="105"  Canvas.Bottom="5"></Image>
                    </Canvas>-->
                </Canvas>
            </Canvas>
        </Grid>
    </Canvas>
    <Canvas x:Name="cn" Grid.Column="2" Grid.Row="1" Background="White" MouseUp="Canvas_MouseUp_1">
        <!--`ActivityInfo Popup up-->
        <Canvas x:Name="ActivityInfo" Background="Green" Height="{Binding ElementName=cn,Path=ActualHeight}" MouseUp="ActivityInfo_MouseUp_1" Visibility="Hidden">
            <TextBlock x:Name="projectdescrption" Foreground="#FFF3800C" FontFamily="segoe_uilight" FontSize="18" Text="Information"  Canvas.Left="10" ></TextBlock>
            <Canvas Background="White" Height="900" Width="200" Canvas.Top="50" Canvas.Left="10">
                <StackPanel Width="200" Height="900" Background="White"      Orientation="Vertical" >
                    <TextBlock x:Name="ActivityTitle" Text="Title" FontFamily="segoe_uilight" FontSize="18" Foreground="Black"></TextBlock>
                    <TextBlock x:Name="txtActivityTitle" Text="Page Design" FontFamily="segoe_uilight" FontSize="12" Foreground="Black"></TextBlock>

                    <TextBlock x:Name="ProjectCompnt" Text="Project Component" FontFamily="segoe_uilight" FontSize="18" Foreground="Black" Margin="0,20,0,0"></TextBlock>
                    <TextBlock x:Name="txtProjectCompnt" Text="Project Component Design" FontFamily="segoe_uilight" FontSize="12" Foreground="Black"></TextBlock>

                    <TextBlock x:Name="Phase" Text="Phase" FontFamily="segoe_uilight" FontSize="18" Foreground="Black" Margin="0,20,0,0"></TextBlock>
                    <TextBlock x:Name="txtPhase" Text="Phase Design" FontFamily="segoe_uilight" FontSize="12" Foreground="Black"></TextBlock>

                    <TextBlock x:Name="Start" Text="Start" FontFamily="segoe_uilight" FontSize="18" Foreground="Black" Margin="0,20,0,0"></TextBlock>
                    <TextBlock x:Name="txtStart" Text="2014-1-16" FontFamily="segoe_uilight" FontSize="12" Foreground="Black"></TextBlock>

                    <TextBlock x:Name="End" Text="End" FontFamily="segoe_uilight" FontSize="18" Foreground="Black" Margin="0,20,0,0"></TextBlock>
                    <TextBlock x:Name="txtEnd" Text="2014-2-16" FontFamily="segoe_uilight" FontSize="12" Foreground="Black"></TextBlock>

                    <TextBlock x:Name="Activitydescrption" Foreground="Black" FontFamily="segoe_uilight" FontSize="18" Text="Description"  Margin="0,20,0,0"></TextBlock>
                    <TextBlock x:Name="txtActivitydescrption"  HorizontalAlignment="Left" Text="Loresum lipsum Loresum lipsum Loresum lipsum lipsum Loresum lipsum lipsum Loresum lipsum"  Height="70" Width="180"  FontFamily="segoe_uilight"  TextWrapping="Wrap" Margin="0,0,0,0" FontSize="12" Foreground="Black"></TextBlock>


                    <TextBlock x:Name="ActivityRequirement" Foreground="Black" FontFamily="segoe_uilight" FontSize="18" Text="Requirement"  Margin="0,20,0,0"></TextBlock>
                    <TextBlock x:Name="txtActivityRequirement"  HorizontalAlignment="Left" Text="Loresum lipsum Loresum lipsum Loresum lipsum lipsum Loresum lipsum lipsum Loresum lipsum"  Height="70" Width="180"  FontFamily="segoe_uilight"  TextWrapping="Wrap" Margin="0,0,0,0" FontSize="12" Foreground="Black"></TextBlock>

                    <Button x:Name="btnsave" Content="Save" Foreground="Black" Height="30" Width="100" HorizontalAlignment="Right" Background="#FFF3800C"></Button>
                </StackPanel>
            </Canvas>
        </Canvas>

        <!--`Activity Comments-->
        <Canvas x:Name="Comments" Background="White" Height="{Binding ElementName=cn,Path=ActualHeight}" MouseUp="Comments_MouseUp_1" Visibility="Hidden">
            <TextBlock x:Name="ActivityComments" Foreground="#FFF3800C" FontFamily="segoe_uilight" FontSize="23" Text="Comments"  Canvas.Left="35"></TextBlock>
            <TextBox x:Name="txtComments" Height="110" Width="200" BorderBrush="Black" TextWrapping="Wrap"   Canvas.Top="40" Canvas.Left="5" VerticalScrollBarVisibility="Visible" AcceptsReturn="True"></TextBox>
            <Button x:Name="btnsavecomments" Content="Send" Foreground="Black" Height="30" Width="100" Canvas.Top="170" Canvas.Left="35" Background="#FFF3800C"></Button>

            <ListBox Canvas.Top="220" BorderBrush="White">
                <ListBoxItem>
                    <!--<ListBox.ItemTemplate>
                    <DataTemplate>-->
                    <Canvas Width="220" Height="620">
                        <StackPanel Width="200" Height="Auto" Canvas.Top="20"   Orientation="Vertical" >
                            <Border BorderThickness="2,2,2,2" CornerRadius="4" Background="#E26806">
                                <TextBlock x:Name="txtthreadComments"  Height="Auto" Width="190" TextWrapping="Wrap" Background="#E26806" Text="g rg rg r g rg rg rg rg er gre ger ger g g gr" Foreground="White" ></TextBlock>
                            </Border>
                            <Image x:Name="imgthread" Height="30" Width="30" Margin="-100,-12,0,0" Source="D:\Amrit\Working Code\smart Info WPF app\SmartInfo\SmartAccount\SmartAccount\img\tol_tip.jpg"></Image>
                            <TextBlock x:Name="threadtime" Text="2014-6-7 12:00" HorizontalAlignment="Stretch" Margin="0,0,10,0" FontStyle="Italic" Height="20" Width="150" Foreground="Black" FontSize="16"></TextBlock>
                            <TextBlock x:Name="threadPostedBy" Text="Amrit Verma"   Height="20" Width="150" Foreground="Black" FontStyle="Italic"  FontWeight="Bold" FontSize="15"></TextBlock>

                        </StackPanel>
                    </Canvas>
                </ListBoxItem>
                <!--</DataTemplate>
                </ListBox.ItemTemplate>-->
            </ListBox>

        </Canvas>

        <!-- Assigned Memebres  -->
        <Canvas x:Name="AssignedMemebres" Background="White" Height="{Binding ElementName=cn,Path=ActualHeight}"  Visibility="Hidden">
            <TextBlock x:Name="Memebres" Foreground="#FFF3800C" FontFamily="segoe_uilight" FontSize="18" Text="Assigned Members"  Canvas.Left="30"></TextBlock>
            <ListBox Canvas.Top="40" BorderBrush="White">
                <ListBoxItem>
                    <!--<ListBox.ItemTemplate>
                    <DataTemplate>-->
                    <Canvas Width="220" Height="620">
                        <TextBlock x:Name="AssignMemeber"  Foreground="Black" FontFamily="segoe_uilight" FontSize="14" Text="+ Assign Memeber" FontStyle="Italic" Canvas.Left="12" Canvas.Top="-3"></TextBlock>

                        <StackPanel Width="200" Height="Auto" Canvas.Top="20"   Orientation="Vertical" Canvas.Left="20">
                                <TextBlock FontFamily="segoe_uilight" FontSize="16" x:Name="txtassignedto" Text="Amrit Verma" FontWeight="Bold"></TextBlock>
                                <TextBlock FontFamily="segoe_uilight" FontSize="16" x:Name="txtassignedrole" Text="Developer" ></TextBlock>

                            <TextBlock FontFamily="segoe_uilight" FontSize="12" x:Name="Email" Text="Email"  Margin="0,10,0,0"></TextBlock>
                            <TextBlock FontFamily="segoe_uilight" FontSize="14" x:Name="txtEmail" Text="[email protected]" FontStyle="Italic"></TextBlock>

                            <TextBlock FontFamily="segoe_uilight" FontSize="12" x:Name="Phone" Text="Phone" Margin="0,10,0,0"></TextBlock>
                            <TextBlock FontFamily="segoe_uilight" FontSize="14" x:Name="txtPhone" Text="555-111 442 213" FontStyle="Italic"></TextBlock>

                            <TextBlock FontFamily="segoe_uilight" FontSize="12" x:Name="WorkingHours" Text="Working Hours"  Margin="0,10,0,0"></TextBlock>
                            <TextBlock FontFamily="segoe_uilight" FontSize="14" x:Name="txtWorkingHours" Text="9:00 - 12:00" FontStyle="Italic"></TextBlock>

                            <TextBlock FontFamily="segoe_uilight" FontSize="12" x:Name="WorkingDays" Text="Working Days"  Margin="0,10,0,0"></TextBlock>
                            <TextBlock FontFamily="segoe_uilight" FontSize="14" x:Name="txtWorkingDays" Text="Mon-Sat" FontStyle="Italic"></TextBlock>

                        </StackPanel>
                    </Canvas>
                </ListBoxItem>
                <!--</DataTemplate>
                </ListBox.ItemTemplate>-->
            </ListBox>
        </Canvas>
    </Canvas>
    <Canvas Grid.Column="3" Grid.Row="1" Background="Orange" >

        <StackPanel Canvas.Left="0" Background="Gray" Width="60" MouseUp="StackPanel_MouseUp_1" x:Name="stackpnlinfo">
            <Image  Source="img\icons\icon.png" Height="20px" Width="20px" />
            <!--<Image  Source="img\btn_img.jpg" Height="45px" Width="60px" />-->

            <Label  HorizontalAlignment="Center"   Content="Info" Foreground="White" FontFamily="segoe_uilight" BorderThickness="0" ></Label>



        </StackPanel>
        <StackPanel Canvas.Left="0" Canvas.Top="45" Background="Gray" Width="60" MouseUp="StackPanel_MouseUp_2" x:Name="stackpnlcomment">
            <Image  Source="img\icons\icon_1.png" Height="20px" Width="20px" />
            <Label   HorizontalAlignment="Center"   Content="Comments" Foreground="White" FontFamily="segoe_uilight" BorderThickness="0" >

            </Label>

        </StackPanel>
        <StackPanel Canvas.Left="0" Canvas.Top="90" Background="Gray" Width="60" >
            <Image  Source="img\icons\icon_2.png" Height="20px" Width="20px" />
            <Label HorizontalAlignment="Center"   Content="Files" Foreground="White" FontFamily="segoe_uilight" BorderThickness="0" >

            </Label>

        </StackPanel>
        <StackPanel Canvas.Left="0" Canvas.Top="135" Background="Gray" Width="60" x:Name="AssignedMembrs" MouseUp="AssignedMembrs_MouseUp_1">
            <Image  Source="img\icons\at.png" Height="20px" Width="20px" />
            <Label HorizontalAlignment="Center"   Content="Assigned Members" Foreground="White" FontFamily="segoe_uilight" BorderThickness="0" >

            </Label>

        </StackPanel>

    </Canvas>



</Grid>

c#

private void InnerActivityListBox_PreviewMouseLeftButtonDown_1(object sender, MouseButtonEventArgs e) { ListBox Phaseitem = (ListBox)sender as ListBox; if (_dragged != null) return;

        UIElement element = Phaseitem.InputHitTest(e.GetPosition(Phaseitem)) as UIElement;
        while (element != null)
        {
            if (element is ListBoxItem)
            {
                _dragged = (ListBoxItem)element;
                break;
            }
            element = VisualTreeHelper.GetParent(element) as UIElement;
        }
        SourcePhaseID = Phaseitem.Tag.ToString();

        Globallb = Phaseitem;
        Globallbi = _dragged;
       Phaseitem.Items.Remove(_dragged);
    }
    private void InnerActivityListBox_DragEnter_1(object sender, DragEventArgs e)
    {
        if (_dragged == null || e.Data.GetDataPresent(DataFormats.Text, true) == false)
            e.Effects = DragDropEffects.None;
        else
            e.Effects = DragDropEffects.All;
    }
    private void InnerActivityListBox_Drop_1(object sender, DragEventArgs e)
    {
         ListBox Phaseitem = (ListBox)sender as ListBox;
         DestinationPhaseID = Phaseitem.Tag.ToString();
         Phaseitem.Items.Add(_dragged);
    }
    private void InnerActivityListBox_DragOver_1(object sender, DragEventArgs e)
    {
        e.Effects = DragDropEffects.Move;
    }
1
can you also post your xaml?Nitin
You can find a number of linked articles in the answer to the Implement drag and drop in wpf question.Sheridan
i added XAML and some Drag and Drop methods please have a look now. If i am missing Something?Harjeet Singh

1 Answers

0
votes

If this is you are trying to achieve. This also include designing your own Adorner to be shown as Ghost Perview while dragging

http://www.codeproject.com/Articles/43702/Drag-and-Drop-in-WPF-Part-II

and this article has vanilla code and doing exactly what you want

http://www.essentialobjects.com/doc/5/controls/treeview/dragdrop.aspx#list_box