Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. WPF
  4. User Control drag and drop

User Control drag and drop

Scheduled Pinned Locked Moved WPF
helpquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    thangavel1987
    wrote on last edited by
    #1

    i create a new user control and that is included in my window. and i try to drag an element from the user control and drop it in the window. in the user control i have listview . i drag the listview items from the listview and drop in the window. how i can get the listview control and that particular listview item??? I have to remove the listview item from the listview. any one pls help me......

    A 1 Reply Last reply
    0
    • T thangavel1987

      i create a new user control and that is included in my window. and i try to drag an element from the user control and drop it in the window. in the user control i have listview . i drag the listview items from the listview and drop in the window. how i can get the listview control and that particular listview item??? I have to remove the listview item from the listview. any one pls help me......

      A Offline
      A Offline
      ABitSmart
      wrote on last edited by
      #2

      It is difficult to answer the question without knowing how you are implementing the Drag and drop ? Taking a guess, removing the object from your object collection would remove it from the listview automatically ?

      T 1 Reply Last reply
      0
      • A ABitSmart

        It is difficult to answer the question without knowing how you are implementing the Drag and drop ? Taking a guess, removing the object from your object collection would remove it from the listview automatically ?

        T Offline
        T Offline
        thangavel1987
        wrote on last edited by
        #3

        This is in user control <ListView name="pieChart" > <ListViewItem Style="{StaticResource listviewItemRes}" PreviewMouseLeftButtonDown="ListViewItem_PreviewMouseLeftButtonDown" /> <ListView /> this is in window <Window x:Class="Music_Diary.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" AllowDrop="True" Drop="Window_Drop" WindowStyle="None" Top="0" Left="0" > private void ListViewItem_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { DragDrop.DoDragDrop(this.pieChart, sender , DragDropEffects.Copy); } private void Window_Drop(object sender, DragEventArgs e) { //here what i am going to write to remove the listview item from the listview }

        modified on Thursday, March 26, 2009 3:48 AM

        A 1 Reply Last reply
        0
        • T thangavel1987

          This is in user control <ListView name="pieChart" > <ListViewItem Style="{StaticResource listviewItemRes}" PreviewMouseLeftButtonDown="ListViewItem_PreviewMouseLeftButtonDown" /> <ListView /> this is in window <Window x:Class="Music_Diary.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" AllowDrop="True" Drop="Window_Drop" WindowStyle="None" Top="0" Left="0" > private void ListViewItem_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { DragDrop.DoDragDrop(this.pieChart, sender , DragDropEffects.Copy); } private void Window_Drop(object sender, DragEventArgs e) { //here what i am going to write to remove the listview item from the listview }

          modified on Thursday, March 26, 2009 3:48 AM

          A Offline
          A Offline
          ABitSmart
          wrote on last edited by
          #4

          See this link DragDrop databound[^] Note the GetBoundItemFromPoint method which might help you.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups