Error while removing Items from WPF List View.

Oct 31 2008 8:57 AM

Hi all

My Self Sreeraj R . I am a newbie into wpf.

My problem is am getting error while am trying to remove an item from the list view. The XAML for my listview is given below

<ListView.View>

<GridView>

<GridViewColumn Header="Tail Number" DisplayMemberBinding="{Binding XPath=Fleet}" Width="120" HeaderTemplate="{StaticResource ListHeaderStyle}"/>

<GridViewColumn Header="Task ID" DisplayMemberBinding="{Binding XPath=ID}" Width="120" HeaderTemplate="{StaticResource ListHeaderStyle}" />

<GridViewColumn Header="Task Description" DisplayMemberBinding="{Binding XPath=Description}" Width="175" HeaderTemplate="{StaticResource ListHeaderStyle}"/>

<GridViewColumn Header="Duration" DisplayMemberBinding="{Binding XPath=Duration}" Width="340" HeaderTemplate="{StaticResource ListHeaderStyle}" />

</GridView>

</ListView.View>

</ListView>

and am binding dat from an XML file .

i need to drag items from the list view . Also i need to remove the item from the List View after dragging .

I wrote the code for this but is not working while am trying to remove a particular item but am able to remove the entire items by the following code

XmlElement objElement = (XmlElement)e.Data.GetData(typeof(XmlElement));

XmlDocument objDoc = objElement.OwnerDocument;

objDoc.RemoveAll();

 

Please Help me in finding a solution for this problem.