private void InitializeComponent() { AvaloniaXamlLoader.Load(this); DGV = this.FindControl <DataGrid>(nameof(DGV)); DGV.SelectionChanged += DGV_SelectionChanged; DGV.CellPointerPressed += DGV_CellPointerPressed; DGV.DoubleTapped += (s, e) => DoubleClickEx?.Invoke(s, e); //---DGV.KeyDown += DGV_KeyDown; #region comm. /*DGV.AddHandler( * InputElement.PointerPressedEvent, * (s, e) => * { * var pp = e.GetCurrentPoint( null ); * Debug.WriteLine( $"PointerPressedEvent: {pp.Position}" ); * if ( pp.Properties.IsRightButtonPressed ) * { * var coll = (e.Source as IControl)?.GetSelfAndVisualAncestors().OfType< DataGridColumnHeader >().FirstOrDefault(); * if ( coll != null ) * { * e.Pointer.Capture( null ); * e.Handled = true; * } * } * }, * handledEventsToo: true ); */ #endregion this.Styles.Add(GlobalStyles.Dark); }
private void DGV_DoubleClick(object sender, EventArgs e) => DoubleClickEx?.Invoke(sender, e);