非編集状態のチェックボックス型セルで[+]や[-]キーによるチェック状態の切替ができない

文書番号 : 39448     文書種別 : 不具合     登録日 : 2016/06/30     最終更新日 : 2016/12/07
文書を印刷する
対象製品
SPREAD for WPF 1.0J
状況
修正済み
詳細
非編集状態のチェックボックス型セルで、[+]や[-]キーなど、Key列挙体の以下に該当するキーを押下するとセルは編集状態になりますが、チェック状態が変わりません。

・Key.Add
・Key.Subtract
・Key.OemPlus
・Key.OemMinus

セルが編集状態の場合は、チェック状態が切り替わります。
回避方法
Service Pack 3(v1.0.2016.1207)で修正済みです。
Service Pack 3(v1.0.2016.1207)より前のバージョンでは次の回避方法が有効です。
------------------------------------------

PreviewKeyDownイベントを次のように実装することで、回避できます。

◎サンプルコード(VB)
Private Sub GcSpreadGrid1_PreviewKeyDown(sender As Object, e As KeyEventArgs) Handles GcSpreadGrid1.PreviewKeyDown
  If Not GcSpreadGrid1.ActiveCell Is Nothing And
   TypeOf GcSpreadGrid1.ActiveCell.InheritedCellType Is CheckBoxCellType Then
    If e.Key = Key.Add Or e.Key = Key.Subtract Or
      e.Key = Key.OemPlus Or e.Key = Key.OemMinus Then
      GcSpreadGrid1.BeginEdit()
    End If
  End If
End Sub

◎サンプルコード(C#)
private void GcSpreadGrid1_PreviewKeyDown(object sender, KeyEventArgs e)
{
  if (gcSpreadGrid1.ActiveCell != null && gcSpreadGrid1.ActiveCell.InheritedCellType is CheckBoxCellType)
  {
    if (e.Key == Key.Add|| e.Key == Key.Subtract||
      e.Key == Key.OemPlus|| e.Key == Key.OemMinus)
    {
      gcSpreadGrid1.BeginEdit();
    }
  }
}