// check to ensure that:
// 1. the left mouse button was pressed
// 2. the hit test type is a cell
// 3. the column is of type DataGridButtonColumn
if ( e.Button == MouseButtons.Left &&
hti.Type == DataGrid.HitTestType.Cell &&
this.DataGridTableStyle.GridColumnStyles[ hti.Column ] is DataGridButtonColumn ) {
to 樓主
public class DataGridButtonColumn : DataGridColumnStyle {
protected override void SetDataGridInColumn( DataGrid value ) {
base.SetDataGridInColumn( value );
// subscribe to DataGrid events
this.DataGridTableStyle.DataGrid.MouseDown += new MouseEventHandler(DataGrid_MouseDown);
this.DataGridTableStyle.DataGrid.MouseUp += new MouseEventHandler(DataGrid_MouseUp);