H
H
Hixac2020-09-13 15:52:23
WPF
Hixac, 2020-09-13 15:52:23

How to call a variable in WPF?

There is a variable i in the MainWindow class, I need to call this variable and change it in ShopWindow.
Made a reference to the MainWindow class ww = new MainWindow();
ww.i and does not see.
Where did I mess up? "Public Static" modifiers cost.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
cicatrix, 2020-09-13
@Hixac

new MainWindow(), as you might guess, will create a NEW instance, and you need an existing one.
Either keep a reference to the main window, or pass it when creating ShopWindow.
And static there, in general, is not needed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question