This is a migrated thread and some comments may be shown as answers.

Adding click event handler to template

3 Answers 97 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jerry Kurata
Top achievements
Rank 1
Jerry Kurata asked on 10 Aug 2010, 07:29 PM
Hi,

I have Cell templates for my columns that I load at runtime via the XAMLReader.Load() method.   This works fine for most of the templates, however not for templates that contain a button that references a handler in the XAML's codebehind.  When I attempt to load the grid with these templates an exception is thrown.  This appears to be because SL cannot resolve at runtime the name of the Click handler.  

With the SL Datagrid people have hooked up the handler in the Grid's RowLoading Event (see http://forums.silverlight.net/forums/t/167310.aspx).  Since this event is not supported in the RadGridView, what are my options?

Thanks,

Jerry

3 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 11 Aug 2010, 12:43 PM
Hello Jerry Kurata,

I have prepared an example that creates a column and loads its template with XamlReader.Load method-the click event handler fires for all buttons within that column.
Please let me know if this works for you.

Regards,
Vanya Pavlova
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Jerry Kurata
Top achievements
Rank 1
answered on 11 Aug 2010, 04:26 PM
Vanya,

Thanks you for the sample.

I trying this out one issue I ran into was that the sender of the click event is always the gridview.  I need to be able to determine which button control in the row was pressed.  The action I take will be based on other values from the row. Is there to determine the exact control (and it's row) that was clicked?

Jerry
0
Vanya Pavlova
Telerik team
answered on 12 Aug 2010, 03:59 PM
Hi Jerry Kurata,

Could you take a look at this forum thread.
I would be glad if I can assist you further.

Regards,
Vanya Pavlova
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Jerry Kurata
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Jerry Kurata
Top achievements
Rank 1
Share this question
or