How to get column value in selectedItems wpf?

I have many records from a database and i display it in a ListView. I need to delete it if I select it (multi-selection).

But i need the Id (a column) to delete it and i can't get it. Please help^^

exemple:

column: id name note ... 1 name1 note1 2 ... 3 ...

if i select 1 and 3 I need to get the value (1 and 3). Thanks in advance!

--------------Solutions-------------

loop through all the seleted rows and try this.

Subitems[columnnumber] will be the column numbr of the id field

lv.Items[i].SubItems[1].Text

Category:wpf Time:2010-03-23 Views:1

Related post

  • How to limit the rows and columns of ShowGridLines in WPF Grid? 2010-05-01

    How to limit the rows and columns of ShowGridLines in WPF Grid? By default, ShowGridLines will be applied to all rows and columns, is there any way to set the rows and columns that ShowGridLines is effective? Thanks --------------Solutions-----------

  • Multi-column Tree-View in WPF 2009-01-21

    Anyone know where I can get a control like this? Thanks! --------------Solutions------------- I've implemented this based on the old blog post here. But if I remember right I had to do some manual work to get things to work right. Specifically with t

  • The Columns property on my WPF Toolkit DataGrid isn't set despite the DataContext being set 2009-04-09

    I've created a DataTable using reflection to get the properties from my class and set this as the DataContext for my Microsoft.Windows.Controls.DataGrid: // Create the columns based on the data in the album info - get by reflection var ai = new Album

  • Making a DataGrid Column Header sortable in WPF using C# 2009-08-18

    I am using C# in Visual Studio 2008 and I have install the WPF Toolkit. I created a DataGrid in testtest.xaml. The ID and Parts $ columns have the ability to sort the DataGrid by clicking on their respecteive column headers. However, the column heade

  • How to remove the auto added column (HeaderRole=Padding) in WPF GridView 2010-12-29

    I'm trying to make a custom gridview in WPF but I just realized that as this link says: The GridViewHeaderRowPresenter class performs layout for the column headers in a GridView and places an additional column header at the end to add space and becau

  • Let user select what columns to display on WPF DataGrid 2011-01-12

    My DataGrid has a default set of columns to display, but I'd also like to let the user select/un-select columns displayed on their application. Is there a relatively easy way to do that in WPF? The DataGrid is bound to a DataTable. Note: I may just g

  • How to add columns at runtime in WPF DataGrid from ViewModel? 2012-12-09

    I don't have the column names at compile time. It would be available in an array of strings at runtime. I need to read this array and create columns for wpf datagrid. I have MVVM pattern setup and my View has the DataContext setup to ViewModel. I am

  • How to hide the Column header in a WPF DataGrid? 2009-07-02

    I am using a DataGrid in Expression Blend but I just need to show only the registries and hide the ColumnHeader. How do I do that? --------------Solutions------------- If you look at the properties of the DataGrid there should be a Header section, in

  • How to set widths of columns in Listview in WPF? 2010-06-18

    I have a listview and I need to have width of first column automatic (so the width is properly measurized) and second column that will take the rest of space in the head of listview. How can I do that? My XAML looks like this right now: <ListView

  • Generating columns dynamically in the WPF DataGrid? 2010-08-25

    <DataGrid ItemsSource="{Binding}" AutoGenerateColumns="False"> <DataGrid.Columns> <DataGridTextColumn Header="First Name" Binding="{Binding FirstName}" /> </DataGrid.Columns> </DataGrid> In the above snippet the DataGrid

  • How can one dynamically modify row and column definitions of a WPF grid? 2010-10-17

    I have two dimensional data with varying number of rows and columns and must display it to the user for editing. The format of the data itself is essentially described by a list of row and column descriptors with a header text for each row or column.

  • Elegant way of enabling specific Columns in a dynamic WPF UniformGrid to be resizable 2010-11-24

    like the title says: Is there an elegant way of enabling specific columns in a dynamic UniformGrid to be resizable? The details: I have a ItemsControl and set the ItemsPanelTemplate to be of type UniformGrid. The ItemTemplate is set to a Custom Contr

  • Sharing Column Widths Between Multiple WPF Controls 2010-12-21

    Is there any way of sharing column widths between controls, not just between multiple grids on the same control? Crude diagram of what I'm trying to get at: I'm currently messing around with getting the widths of the labels in the first column of eac

  • How to disable a column selection in DataGrid WPF? 2011-07-07

    I have this column in my datagrid <DataGridTemplateColumn Header="Delete" IsReadOnly="True" > <DataGridTemplateColumn.CellStyle> <Style TargetType="DataGridCell"> <Setter Property="Background" Value="Transparent"/> <Setter

  • Use vb to add item and change value of second column of listview in wpf 2011-10-02

    This is the xaml of listview <ListView Grid.Column="1" Height="auto" Name="ListView1" Width="auto" AllowDrop ="True" > <ListView.View> <GridView > <GridViewColumn Header="File Name" /> <GridViewColumn Header="Path" />

  • How to add a right click context menu to Column Header for a WPF 4 DataGrid? 2011-10-04

    I want the context menu for a DataGrid's column headers to be different than the rest of the cells. So using the regular ContextMenu property is not going to work. There is DataGrid.RowHeaderTemplate, but I can't find DataGrid.ColumnHeaderTemplate. E

  • it's posible to animate DataGrid column collapsing in Silverlight/WPF? 2011-10-24

    I have a simple DataGrid in Silverlight with this columns templates: <data:DataGrid AutoGenerateColumns="False" ...> <data:DataGridTextColumn x:Name="idCol" Header="Id" Binding="{Binding Id}" /> <data:DataGridTextColumn x:Name="nameCol

  • How do I retrieve column width in a WPF Grid using a GridSplitter? 2011-12-13

    I need to display to the user two listboxes - one on either side of the window - and allow the user to choose how much screen space is devoted to each. I have achieved that much with the following code: <Grid VerticalAlignment="Stretch" Horizontal

  • How to persist column index of a WPF datagrid? 2012-02-12

    I want to persist the index value of each column of my own datagrid but I don't know how to do it. Looks like the index can only be set thru the order of addition of the columns on the xaml code. Any help will be great, thanks. --------------Solution

Copyright (C) pcaskme.com, All Rights Reserved.

processed in 0.529 (s). 13 q(s)