CellOverlayWindow.xaml         Background="White"                                  Width="100" Height="24">         CellOverlayWindow.xaml.cs using System; using System.Runtime.InteropServices; using System.Windows; using System.Windows.Input; using System.Windows.Interop; namespace YourAddIn {     public partial class CellOverlayWindow : Window     {         public CellOverlayWindow()         {             InitializeComponent();             WindowStyle = WindowStyle.None;             ShowInTaskbar = false;             Topmost = true;             Focusable = true;         }         public void FocusEditorDeferred()         {             // Defer to run AFTER Excel’s own activation completes             Dispatcher.BeginInvoke(new Action(() =>             {                 Activate();                 Editor.Focus();                 Keyboard.Focus(Editor);                 Editor.SelectAll();             }), System.Windows.Threading.DispatcherPriority.ApplicationIdle);         }         public void ForceWin32Focus()         {             var hwnd = new WindowInteropHelper(this).Handle;             SetForegroundWindow(hwnd);             SetFocus(hwnd);         }         [DllImport("user32.dll")] static extern IntPtr SetFocus(IntPtr hWnd);         [DllImport("user32.dll")] static extern bool SetForegroundWindow(IntPtr hWnd);         // Optional: handle Enter/Esc here; wire to YourAddIn via events if preferred         private void EditorKeyDown(object sender, KeyEventArgs e)         {             // Prevent F2 (Excel in-cell edit) while overlay is active             if (e.Key == Key.F2)             {                 e.Handled = true;                 return;             }             if (e.Key == Key.Enter)             {                 e.Handled = true;                 CommitAndHide?.Invoke(this, EventArgs.Empty);             }             else if (e.Key == Key.Escape)             {                 e.Handled = true;                                CancelAndHide?.Invoke(this, EventArgs.Empty);             }         }         public event EventHandler CommitAndHide;         public event EventHandler CancelAndHide;         private void EditorTextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)         {             // Your inline validation or live preview hooks (optional)         }     }