Button inside a Grid column
Hi,
I want to add a button inside a Grid control, and this is how I am doing it.
and inside my class, I do
this.MyGrid.CellButtonClick += new GridCellButtonClickEventHandler(MyGrid_CellButtonClick);
I do see a button, but the on click event does not get fired. What could be wrong?
Thanks,
Jitesh
I want to add a button inside a Grid control, and this is how I am doing it.
and inside my class, I do
this.MyGrid.CellButtonClick += new GridCellButtonClickEventHandler(MyGrid_CellButtonClick);
I do see a button, but the on click event does not get fired. What could be wrong?
Thanks,
Jitesh
SIGN IN To post a reply.
7 Replies
MN
Muthulakshmi N
Syncfusion Team
August 6, 2010 12:06 PM UTC
Hi Jitesh,
Thank you for your details.
By handling this.MyGrid.CellClick += new GridCellClickEventHandler(MyGrid _CellClick)
event you can listen the action of the button which is present inside the UnboundVisibleColumn of the GDC .
Let us know if you need any details.
Thanks,
Muthulakshmi
Thank you for your details.
By handling this.MyGrid.CellClick += new GridCellClickEventHandler(MyGrid _CellClick)
event you can listen the action of the button which is present inside the UnboundVisibleColumn of the GDC .
Let us know if you need any details.
Thanks,
Muthulakshmi
VJ
Valiyaveettil Jitesh Ramanathu
August 6, 2010 05:59 PM UTC
That works. Thank you.
Jitesh
Jitesh
MN
Muthulakshmi N
Syncfusion Team
August 12, 2010 06:09 AM UTC
Hi Jitesh,
Thank you for your update.
Let us know if you need any details.
Thanks,
Muthulakshmi
Thank you for your update.
Let us know if you need any details.
Thanks,
Muthulakshmi
SJ
Scott Jeslis
August 19, 2010 05:12 PM UTC
This doesn't seem to work if the button doesn't completely fill the cell, use this XAML for example:
MN
Muthulakshmi N
Syncfusion Team
August 25, 2010 05:27 AM UTC
Hi Jitesh,
Thank you for your details.
Here we have prepared a sample which illustrates your request. Please download the sample from the below location.
Link: http://www.syncfusion.com/uploads/redirect.aspx?file=ButtoninUnboundGDC_2edadb33.zip&team=development
Using below xaml you can activate the button which is present inside the UnboundColumn of GridDataControl.
[xaml snippet]
MappingName="unboundColumn"
HeaderText="unboundColumn "
CellTemplate="{StaticResource AddButtonTemplate}" />
Let us know if you need any details.
Thanks,
Muthulakshmi
Thank you for your details.
Here we have prepared a sample which illustrates your request. Please download the sample from the below location.
Link: http://www.syncfusion.com/uploads/redirect.aspx?file=ButtoninUnboundGDC_2edadb33.zip&team=development
Using below xaml you can activate the button which is present inside the UnboundColumn of GridDataControl.
[xaml snippet]
HeaderText="unboundColumn "
CellTemplate="{StaticResource AddButtonTemplate}" />
Let us know if you need any details.
Thanks,
Muthulakshmi
VJ
Valiyaveettil Jitesh Ramanathu
October 13, 2010 09:28 PM UTC
Hi,
Your previous suggestion helped and I was able to capture the CellClick event. But, my event handler does not tell me which is the row from which the cell is clicked. The rowIndex from eventArgs return the row Id, but that information is not useful after the user sorts my Grid on one of the columns. I thought of binding to SlectedItem, but that returns null.
Can you please tell me how I can access the data object corresponding to specific row that is clicked?
Thanks,
Jitesh
Your previous suggestion helped and I was able to capture the CellClick event. But, my event handler does not tell me which is the row from which the cell is clicked. The rowIndex from eventArgs return the row Id, but that information is not useful after the user sorts my Grid on one of the columns. I thought of binding to SlectedItem, but that returns null.
Can you please tell me how I can access the data object corresponding to specific row that is clicked?
Thanks,
Jitesh
KA
Kamalakannan A
Syncfusion Team
November 15, 2010 11:39 AM UTC
Hi Jitesh,
Sorry for the delay caused.
The Cell row column index can be calculated from the mouse button down point using PointToCellRowColumnIndex() method as follows.
[Code Snippet [C#]
this.grid.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(grid_PreviewMouseLeftButtonDown);
void grid_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
RowColumnIndex RowCol = grid.PointToCellRowColumnIndex(e);
}
Let us know if you need any details.
Thanks,
Kamal.
SIGN IN To post a reply.
- 7 Replies
- 4 Participants
-
VJ Valiyaveettil Jitesh Ramanathu
- Aug 6, 2010 02:22 AM UTC
- Nov 15, 2010 11:39 AM UTC