チェックボックス型セルをロックした状態で、キー操作によりチェック状態が変化する

文書番号 : 41403     文書種別 : 不具合     登録日 : 2017/11/02     最終更新日 : 2018/07/25
文書を印刷する
対象製品
SPREAD for WPF 1.0J
状況
修正済み
詳細
チェックボックス型セルについて、セルをロックした状態(LockedプロパティにTrueを設定)にもかかわらず、[+]キー(Key.Add、Key.OemPlus)および、[-]キー(Key.Subtract、Key.OemMinus)の押下でチェック状態が変更されます。

なお、[スペース]キー(Key.Space)の押下および、マウスのクリックによる動作は問題ありません。
回避方法
Service Pack 4(v1.0.2018.0725)で修正済みです。
Service Pack 4(v1.0.2018.0725)より前のバージョンでは次の回避方法が有効です。
------------------------------------------

PreviewKeyDownイベントで対象のキーを無効化します。

◎サンプルコード(VB.NET)
Private Sub GcSpreadGrid1_PreviewKeyDown(sender As Object, e As KeyEventArgs)
  If TypeOf GcSpreadGrid1.ActiveCell.CellType Is CheckBoxCellType AndAlso GcSpreadGrid1.ActiveCell.Locked = True OrElse e.Key = Key.OemPlus OrElse e.Key = Key.Add OrElse e.Key = Key.OemMinus OrElse e.Key = Key.Subtract Then
    e.Handled = True
  End If
End Sub

◎サンプルコード(C#)
public MainWindow()
{
  InitializeComponent();
  GcSpreadGrid1.PreviewKeyDown += GcSpreadGrid1_PreviewKeyDown;
}

private void GcSpreadGrid1_PreviewKeyDown(object sender, KeyEventArgs e)
{
  if (GcSpreadGrid1.ActiveCell.CellType is CheckBoxCellType && GcSpreadGrid1.ActiveCell.Locked == true
    || e.Key == Key.OemPlus || e.Key == Key.Add || e.Key == Key.OemMinus || e.Key == Key.Subtract)
  {
    e.Handled = true;
  }
}