Posted 21 January 2018, 11:39 am EST
I have a C1DataGrid bound to a DataTable. I would like one of the columns to be a DataGridHyperlinkColumn, but instead of, for example, having its click event open a URL in a web browser, I would like it to call a method within the application instead. In a manner similar to the code I’ve included below. Is this possible and if so, how? Thank you.
public class SomeDataGrid : C1DataGrid
{
public SomeDataGrid(DataTable someDataTable)
{
this.AutoGenerateColumns = false;
this.ItemsSource = someDataTable.DefaultView; string someDataColumn = "someDataColumn"; C1.WPF.DataGrid.DataGridHyperlinkColumn column = new C1.WPF.DataGrid.DataGridHyperlinkColumn(); Binding binding = new Binding(); binding.Path = new PropertyPath(someDataColumn); binding.Mode = BindingMode.OneWay; binding.Source = someDataTable.DefaultView; column.Click += (s, e) => { DataRowView drv = e.Row.DataItem as DataRowView; string someInfo = drv[SqlTxt._App_Object_GUID].ToString(); SomeClass.SomeMethod(someInfo); }; this.Columns.Add(column); } } public class SomeClass { public static void SomeMethod(string someInfo) { // Do Something ... } }