7
Through the double click event I need to pull a value from a row/column in a Listvview populated by LINQ to SQL.
For example, when the user needs to select a value from a row/column of this Listview, after the double click event, this information would feed a Textbox with the SQL database ID (not the Listview Index) corresponding to that row/column clicked.
Watch of can help me! Please!
Class that updates the List..
namespace TRSSystem.AcessoDados
public static List<tabProduto> Consultar_ALL()
{
TRSSystemDataClassesDataContext oDB = new TRSSystemDataClassesDataContext();
List<tabProduto> oProdutos = (from Selecao in oDB.tabProdutos orderby Selecao.Descricao select Selecao).ToList<tabProduto>();
return oProdutos;
}
When I Start WPF Form...
listView_tabProduto.ItemsSource = TRSSystem.AcessoDados.tabProdutoAcesso.Consultar_ALL();
Event of the Double Click... (DOESN’T WORK)
private void Select_Item(object sender, MouseButtonEventArgs e)
{
txtDescricao.Text = listView_tabProduto.SelectedIndex.ToString(); -------> Não funciona
}
Do you want the ID or index of the selected item? if it is the index you can do using:
ListView1.SelectedIndex;
– WeezHard
I am wanting to pull the line ID the user will click on the Listview that was loaded by LINQ...
– Felipe Cavalcante
Selectedindex, I can get the position in Listview... But I wanted to get the position in the Database (ID), not in Listview... You see?
– Felipe Cavalcante
yes I understand. I can see the code you use to popular the Listview ?
– WeezHard
suggest edit your post and add code
– WeezHard
Edited... I can understand?
– Felipe Cavalcante