[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

WPF Datagrid Button

Posted on 2011-03-23
2
Medium Priority
?
586 Views
Last Modified: 2012-05-11
I have added a button to a data grid like below but how do I handle the click event?

  <DataGridTemplateColumn>
                                <DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                        <Button Content="Edit" Name="btnEdit" >                                           
                                        </Button>
                                        </DataTemplate>
                                 </DataGridTemplateColumn.CellTemplate>
                            </DataGridTemplateColumn>
0
Comment
Question by:Kevin Robinson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 16

Accepted Solution

by:
Imran Javed Zia earned 2000 total points
ID: 35197092
Hi, you can either use RowCommand event and pass the CommandName in button as
<DataGridTemplateColumn>
                                <DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                        <Button Content="Edit" Name="btnEdit" CommandName="Edit">                                          
                                        </Button>
                                        </DataTemplate>
                                 </DataGridTemplateColumn.CellTemplate>
                            </DataGridTemplateColumn>
Or you can uas add event Handler directly as
<DataGridTemplateColumn>
                                <DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                        <Button Content="Edit" Name="btnEdit" OnClick="btnEdit_click" >                                           
                                        </Button>
                                        </DataTemplate>
                                 </DataGridTemplateColumn.CellTemplate>
                            </DataGridTemplateColumn>
0
 
LVL 3

Author Comment

by:Kevin Robinson
ID: 35197239
OK got that.. How do I then get the value (item) of the row.

0

Featured Post

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question