Welcome to the Xceed Community | Help
Community Search  
More Search Options

Row Click Event

Sort Posts: Previous Next
  •  08-21-2008, 9:48 AM Post no. 14310

    Row Click Event

    Hi,

    I have used the XceedDataGrid and populated the grid with the DataSet. Now to Keep the things simple i just wanted to get the value of a cell in the selected row of the when users click on a particular row...???
  •  08-22-2008, 1:20 AM Post no. 14353 in reply to 14310

    Re: Row Click Event

    Any ideas ....... I tried to create a Routed Event Handler on DataGridControl Loaded event but that does'nt seems to work..................
  •  08-22-2008, 8:16 AM Post no. 14371 in reply to 14353

    Re: Row Click Event

    This example demonstrates how to handle the events of an element. You can change it to be used on a DataCell rather than a DataRow. Note that the sender will be the element and can be cast as such.

    http://doc.xceedsoft.com/products/XceedWpfDataGrid/Subscribing_to_the_events_of_an_element.html 

    If you have the DataRow, you can get the cell from its Cells collection. If you have the cell, you can access its content through its Content property. 


    Senior Technical Writer
    - Xceed Software

    In three words I can sum up everything I've learned about life: it goes on.
  •  03-23-2009, 7:38 AM Post no. 19520 in reply to 14310

    Re: Row Click Event

    Hi,

    You can do like that:

    1. handle an event in Xceed grid (for example: I handle MouseDoubleClick event)

    2. Use this code ()

            private void dgPart_MouseDoubleClick(object sender, MouseButtonEventArgs e)
            {
                DataGridControl dataGridControl = sender as DataGridControl;
                if (dataGridControl != null)
                {
                    Row row = (Row)dataGridControl.GetContainerFromItem(dataGridControl.CurrentItem);
                    Cell currentCell = row.Cells[dataGridControl.CurrentColumn.Index];
                    if (currentCell != null && currentCell.HasContent)
                    {
                        // Get value here
                    }
                }
            }

    Hope to help you

View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.