最初の編集開始時に[space]キーでコンボボックス型セルのドロップダウンリストが表示されない
対象製品
SPREAD for WPF 1.0J
状況
修正済み
詳細
最初の編集開始時に[space]キーでコンボボックス型セルのドロップダウンリストが表示されません。
【手順】
1.新規ウィンドウにSPREADを配置します
2.下記サンプルコードをコピーし、アプリケーションを実行します
3.B1セルをクリックします
4.[space]キーを押下します
--ドロップダウンリストが表示されません
◎サンプルコード(VB)
◎サンプルコード(C#)
【手順】
1.新規ウィンドウにSPREADを配置します
2.下記サンプルコードをコピーし、アプリケーションを実行します
3.B1セルをクリックします
4.[space]キーを押下します
--ドロップダウンリストが表示されません
◎サンプルコード(VB)
Public Sub New()
' この呼び出しはデザイナーで必要です。
InitializeComponent()
Dim combo As New GrapeCity.Windows.SpreadGrid.ComboBoxCellType()
combo.Items.Add("111")
combo.Items.Add("222")
combo.Items.Add("333")
GcSpreadGrid1.Columns(1).CellType = combo
End Sub
◎サンプルコード(C#)
public MainWindow()
{
InitializeComponent();
GrapeCity.Windows.SpreadGrid.ComboBoxCellType combo = new GrapeCity.Windows.SpreadGrid.ComboBoxCellType();
combo.Items.Add("111");
combo.Items.Add("222");
combo.Items.Add("333");
gcSpreadGrid1.Columns[1].CellType = combo;
}
回避方法
Service Pack 3(v1.0.2016.1207)で修正済みです。
Service Pack 3(v1.0.2016.1207)より前のバージョンでは次の回避方法が有効です。
------------------------------------------
EditElementShowingイベントで編集時のコンボコントにフォーカスを明示的に設定します。
◎サンプルコード(VB)
◎サンプルコード(C#)
Service Pack 3(v1.0.2016.1207)より前のバージョンでは次の回避方法が有効です。
------------------------------------------
EditElementShowingイベントで編集時のコンボコントにフォーカスを明示的に設定します。
◎サンプルコード(VB)
Private Sub GcSpreadGrid1_EditElementShowing(sender As Object, e As GrapeCity.Windows.SpreadGrid.EditElementShowingEventArgs) Handles GcSpreadGrid1.EditElementShowing
Dim combo As GrapeCity.Windows.SpreadGrid.Editors.ComboBoxEditElement = TryCast(e.EditElement, GrapeCity.Windows.SpreadGrid.Editors.ComboBoxEditElement)
If combo IsNot Nothing Then
If Not combo.IsLoaded Then
RemoveHandler combo.Loaded, AddressOf ResetComboFocus
AddHandler combo.Loaded, AddressOf ResetComboFocus
Else
ResetComboFocus(combo, Nothing)
End If
End If
End Sub
Private Sub ResetComboFocus(sender As Object, e As RoutedEventArgs)
Dim combo As GrapeCity.Windows.SpreadGrid.Editors.ComboBoxEditElement = TryCast(sender, GrapeCity.Windows.SpreadGrid.Editors.ComboBoxEditElement)
If combo IsNot Nothing AndAlso combo.IsFocused Then
combo.UpdateLayout()
System.Windows.Input.InputManager.Current.PrimaryKeyboardDevice.ClearFocus()
combo.Focus()
End If
End Sub
◎サンプルコード(C#)
public MainWindow()
{
InitializeComponent();
GrapeCity.Windows.SpreadGrid.ComboBoxCellType combo = new GrapeCity.Windows.SpreadGrid.ComboBoxCellType();
combo.Items.Add("111");
combo.Items.Add("222");
combo.Items.Add("333");
gcSpreadGrid1.Columns[1].CellType = combo;
gcSpreadGrid1.EditModePermanent = true;
gcSpreadGrid1.EditElementShowing += GcSpreadGrid1_EditElementShowing;
}
private void GcSpreadGrid1_EditElementShowing(object sender, EditElementShowingEventArgs e)
{
GrapeCity.Windows.SpreadGrid.Editors.ComboBoxEditElement combo = e.EditElement as GrapeCity.Windows.SpreadGrid.Editors.ComboBoxEditElement;
if (combo != null)
{
if(!combo.IsLoaded)
{
combo.Loaded -= ResetComboFocus;
combo.Loaded += ResetComboFocus;
}
else
{
ResetComboFocus(combo, null);
}
}
}
private void ResetComboFocus(object sender, RoutedEventArgs e)
{
GrapeCity.Windows.SpreadGrid.Editors.ComboBoxEditElement combo = sender as GrapeCity.Windows.SpreadGrid.Editors.ComboBoxEditElement;
if (combo != null && combo.IsFocused)
{
combo.UpdateLayout();
System.Windows.Input.InputManager.Current.PrimaryKeyboardDevice.ClearFocus();
combo.Focus();
}
}