请检查以下内容:
/// <summary>
/// This method returns a custom column control for the AgDataGrid from devex with a button design including button click event handlers
/// </summary>
/// <param name="headerContent">The header column value for this cell</param>
/// <param name="control">The DataTemplate XAML needed to Load the control</param>
/// <param name="routedEventHandler">The Button Click Event</param>
/// <returns>AgDataGridColumn</returns>
public AgDataGridColumn CustomColumn(string headerContent, string control, RoutedEventHandler routedEventHandler)
{
AgDataGridColumn _AgDataGridColumn = new AgDataGridColumn();
_AgDataGridColumn.HeaderContent = headerContent;
_AgDataGridColumn.CellDisplayTemplate = XamlReader.Load(control) as DataTemplate;
_AgDataGridColumn.AllowSorting = DefaultBoolean.False;
_AgDataGridColumn.PrepareCellDisplayElement += (d, _e) =>
{
((Button)_e.DisplayElement).Click -= routedEventHandler;
((Button)_e.DisplayElement).Click += routedEventHandler;
};
return (_AgDataGridColumn);
}
我想将此方法转换为Silverlight数据报。我试图找到一种适当的方法来执行PrepareCellDisplayElement行,添加事件处理程序。对于SL数据报,该方法似乎不存在。任何帮助都将不胜感激。