0

I have a static function in my mainwindow, with a tray icon in it. I Want to call that function from my child window within that mainwindow...

Because I want to give it some values to raise a textballoon.

Now I got the problem that I can't raise WindowState = WindowState.Maximized, because it's a static function...

How to resolve ? I'm using WPF

        private static void notifier_MouseDown(object sender, Forms.MouseEventArgs e)
    {


        ContextMenu menu = new ContextMenu();

        MenuItem open = new MenuItem();
        open.Header = "Open";
        menu.Items.Add(open);

        MenuItem exit = new MenuItem();
        open.Header = "Exit";
        menu.Items.Add(exit);

        if (e.Button == Forms.MouseButtons.Right)
        {
            menu.IsOpen = true;
        }
        if (e.Button == Forms.MouseButtons.Left) {
            menu.IsOpen = false;

            WindowState = WindowState.Maximized;
            Topmost = true;

        }


    }
keno
  • 93
  • 3
  • 11

1 Answers1

0

That's exactly what static doesn't mean.

If you need to access or modify the class instance, you need to make a non-static method.

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964