Hello.
I'm trying to display on a messagebox a particular cell that the user chooses from. I currently have it with fixed values.
var cell = grdSubfamilias.DisplayLayout.Rows[0].Cells["ClassID"].Value;
MessageBox.Show(""+ cell);
That code will always display a fixed value from a cell. What I would like the code to do is display the value depending on what cell the user double clicked.
Thanks!
Hello William,
To determine the cell user was clicked on you may use ElementFromPoint method of UIElement class. Please follow the next link to our online knowledge base where is shown how to get the cell of the UltraGrid where the user has clicked “HOWTO:UltraWinGrid Mouse Position and Cell Identification” and let me know if you have any additional questions.
Thanks for the help. Is this the only way to do this? I'm on an ERP environment and have few options available.
Milko.
Excuse my english, maybe I didn't make myself clear. Anyways, I achieved what I wanted by doing the following.
UltraGridColumn column = this.grdSubfamilias.DisplayLayout.Bands[0].Columns[0]; UltraGridRow row = this.grdSubfamilias.ActiveRow; object cell = row.Cells[column].Value; // CLASS ID VALUE MessageBox.Show("You clicked: " + cell);
Whenever the user double clicks a row on an UltraGrid, the value pops on a MessageBox.
Thanks for the help Milko!
Have a nice day.
Most of the controls in Infragistics for Windows Forms are represent of the screen as hierarchical collection of UIElements. You have an access to each of these elements via the control's main element. The cells in the grid are represented by such elements. So, to answer your question, if not the only way this is the best way to find over which element the mouse is. Then, depending on the type of element, you may get the necessary contextual information you may need. Speaking of the grid’s cell element it contains property Cell, which hold a reference to the cell the element it is responsible for.
One more thing. Can you explain what your limitations are? What you mean by you are on ERP environment and you have few options available?
Looking forward to your reply.