Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wpf: Don't activate FloatingForm when setting Visible manually #2636

Merged
merged 1 commit into from
Mar 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/Eto.Wpf/Forms/FloatingFormHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public override void OnUnLoad(EventArgs e)

private void Application_IsActiveChanged(object sender, EventArgs e)
{
SetVisibility();
SetVisibility(true);
}

public override bool Visible
Expand All @@ -41,7 +41,7 @@ public override bool Visible
set
{
Widget.Properties.Set(Visible_Key, value, true);
SetVisibility();
SetVisibility(false);
}
}

Expand All @@ -51,7 +51,7 @@ public override void Show()
base.Show();
}

void SetVisibility()
void SetVisibility(bool setActive)
{
var currentlyVisible = base.Visible;
var isVisible = Application.Instance.IsActive && Visible;
Expand All @@ -66,13 +66,15 @@ void SetVisibility()
}
base.Visible = isVisible;
}
else
else if (setActive)
{
var oldShowActivated = Control.ShowActivated;
Control.ShowActivated = _wasActive;
base.Visible = isVisible;
Control.ShowActivated = oldShowActivated;
}
else
base.Visible = isVisible;
}
}
}
Loading