作成日: 2026/06/24 最終更新日: 2026/06/24
文書種別
使用方法
詳細
FocusManager.GetFocusedElementメソッドを使用してフォーカスのあるコントロールを取得すると、SPREADの場合は、フォーカスのあるセルの要素が取得されます。セルではなく、GcSpreadGrid自体を取得する場合には、以下のサンプルコードのような方法で対応します。
◎サンプルコード(C#)
◎サンプルコード(C#)
IInputElement focusedControl = FocusManager.GetFocusedElement(this);
FrameworkElement temp = (FrameworkElement)focusedControl;
if(temp.GetType().FullName == "GrapeCity.Windows.SpreadGrid.Editors.GeneralEditElement")
{
while (temp.GetType().FullName != "GrapeCity.Windows.SpreadGrid.GcSpreadGrid")
{
if (temp.Parent != null)
temp = (FrameworkElement)temp.Parent;
else
temp = (FrameworkElement)temp.TemplatedParent;
}
}
System.Diagnostics.Debug.WriteLine(temp.GetType().FullName);