0
Answer

Error while removing Items from WPF List View.

anjusreeraj

anjusreeraj

16y
4.4k
1

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.

Next Recommended Forum