Click here to Skip to main content
15,895,808 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to find value from datagride in wpf
Posted

Here:
http://social.msdn.microsoft.com/Forums/en/wpf/thread/a5fd5413-f055-4b56-83af-6d6bdb1d6fe9[^]

Its some task, if you want to do it from the DataGrid. Easyer to do it from the binding source.
 
Share this answer
 
C#
private void Window_Loaded(object sender, RoutedEventArgs e)
        {
           
            Process[] p = Process.GetProcesses();
            List<li> lst = new List<li>();
            foreach (Process ps in p)
            {
                li pp = new li();
                pp.NAME = ps.ProcessName.ToString();
                lst.Add(pp);
            }
           
            gv1.ItemsSource = lst;
        }
        public class li
        {
            public string NAME
            {
                get;
                set;
            }
        }

C#
private void gv1_SelectionChanged(object sender, SelectionChangedEventArgs e)
       {
           MessageBox.Show(((li)e.AddedItems[0]).NAME);
       }
 
Share this answer
 
v2
Comments
Kenneth Haugland 4-Oct-12 9:28am    
Huh?!? Havent you shown a little too much code here?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900