Click here to Skip to main content
16,004,806 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Can anybody give me an answer for the question .
I have the code in windows application.
I can post that here
C#
foreach (DataGridViewRow dgvrow in dgvPointOfSales.Rows)
              {
                  if (dgvrow.Cells["dgvtxtTotalAmount"].Value != null && dgvrow.Cells["dgvtxtTotalAmount"].Value.ToString() != string.Empty)
                  {
                      dTotal = dTotal + Convert.ToDecimal(dgvrow.Cells["dgvtxtTotalAmount"].Value.ToString());
                  }
              }


I want to convert it in to wpf .Please help me
Posted
Comments
Sergey Alexandrovich Kryukov 10-Nov-14 2:45am    
In what WPF control?
—SA
abdul rafi 11-Nov-14 0:08am    
data grid

1 solution

This is how: http://msdn.microsoft.com/en-us/library/system.windows.controls.datagrid.selectedcells%28v=vs.110%29.aspx[^].

Note that the selection behavior depends on the property SelectedUnit:
http://msdn.microsoft.com/en-us/library/system.windows.controls.datagrid.selectionunit%28v=vs.110%29.aspx[^].

So, as you are interested in selected cell, not row, you need to use either System.Windows.Controls.DataGridSelectionUnit.Cell or maybe System.Windows.Controls.DataGridSelectionUnit.CellOrRowHeader:
http://msdn.microsoft.com/en-us/library/system.windows.controls.datagridselectionunit(v=vs.110).aspx[^].

—SA
 
Share this answer
 

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