Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wpf window Showdialog not getting focus

Tags:

c#

wpf

I am calling a method using delegate to show a color window but that window not getting focus,It is working fine with mouse but for touch it requires one extra click to get focus.

 ColorPickerWindow colorPicker = new ColorPickerWindow ();
        colorPicker.Owner = this;
        colorPicker.ShowInTaskbar = false;
        colorPicker.SetColor(MenuColor);
        colorPicker.ShowDialog();
like image 972
Jawed Khan Avatar asked Feb 09 '26 15:02

Jawed Khan


1 Answers

Just call Element.Focus() on the element you want to focus.

If you mean bring focus to the window try calling window.Activate()

Source : WPF Window set Focus

like image 86
REDEVI_ Avatar answered Feb 12 '26 05:02

REDEVI_