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] Showing a OpenFileDialog after a MouseDown event with MovableByWindowBackground activated captures all clicks afterward #1903

Closed
borjafdezgauna opened this issue Feb 24, 2021 · 3 comments · Fixed by #2108
Labels
Milestone

Comments

@borjafdezgauna
Copy link

After triggering a MouseDown event on a Panel/Button and showing an OpenFileDialog/SelectFolderDialog, the same event will be triggered no matter where I click. If I use Click it works fine, but there is no Click event for panels I'm afraid

Sample:

   class TestWindow : Form
    {
        public TestWindow()
        {
            MovableByWindowBackground = true;
            var layout = new StackLayout() { Orientation = Orientation.Vertical };
            layout.Items.Add(new Label() { Text = "Label" });
            layout.Items.Add(new TextBox() { Text = "TextBox" });

            Panel button = new Panel() { Size = new Size(100, 100), BackgroundColor = Colors.Red };
            button.MouseDown += ButtonClicked;
            layout.Items.Add(button);
            Content = layout;
        }

        private void ButtonClicked(object sender, MouseEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.ShowDialog(null);

//If the following line is commented, it throws exception "InvalidaOperationException: Can only call DragMove when primary mouse button is down", otherwise, it captures all clicks from that moment onward
            //e.Handled = true; 
        }
    }
  • Version: Eto 2.5.10
  • Platform(s): WPF
  • Operating System(s): Windows 10
@cwensley
Copy link
Member

Thanks for reporting the issue!

@cwensley cwensley added this to the 2.5.x milestone Feb 27, 2021
@cwensley
Copy link
Member

Just looking at this again, as a workaround if you use the MouseUp event then this shouldn't happen. A "Click" event would also be fired at this time as well.

@borjafdezgauna
Copy link
Author

Than you Curtis!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants