?
Solved

Get Selected Item wpf datagrid

Posted on 2011-03-11
4
Medium Priority
?
1,290 Views
Last Modified: 2012-05-11
WPF This should be really simple but I just can't find it. New to WPF so sorry about this.
I have a datagrid and just want to click on a cell and either show its contents in a text box or popup a messagebox with the value.
Thought it should be selectedvalue or selecteditem or something like that but have had no luck sofar.

Thanks
Cnat even find WPF zone to put this question in
0
Comment
Question by:Eamon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 11

Accepted Solution

by:
Sudhakar Pulivarthi earned 2000 total points
ID: 35108248
0
 
LVL 1

Author Comment

by:Eamon
ID: 35109813
This is how the dataGridd is filled

cmd.ExecuteNonQuery();
SqlDataAdapter daPopGRN = new SqlDataAdapter(cmd);

DataSet dsPopGRN = new DataSet();
daPopGRN.Fill(dsPopGRN, "GRN");

dgGrn.ItemsSource = dsPopGRN.Tables[0].DefaultView;
0
 
LVL 11

Expert Comment

by:Sudhakar Pulivarthi
ID: 35110378
Hi Eamon,

Here is how a solution is provided to your requirement.
http://stackoverflow.com/questions/3774140/wpf-datagrid-datatable-large-number-of-rows
0
 
LVL 1

Author Closing Comment

by:Eamon
ID: 35213587
I ended up using this.

int i = dgGrn.Items.IndexOf(dgGrn.SelectedItem);
                var rowData = dgGrn.Items[i] as DataRowView;
                ret = rowData[ColName].ToString();
0

Featured Post

Not sure which OpenStack Certification to get?

So you’ve realized you might want to get certified in OpenStack, but you’re not sure what the benefits might be or even which one you should take. You know there are several certification courses you can choose from, but how do you know which one is right for you?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question