'Called function is not changing visibility of an element- wpf c#
I've got a problem with my functions. I have panel with menu:
public void ChangeAppControlPush(object sender, MouseButtonEventArgs e)
{
var tag = ((StackPanel)sender).Tag;
int i = int.Parse((string)tag);
MenuValues.panelShowClicked = i;
menuPanel menuPanel = new();
menuPanel.ChangeWindowAppPush();
}
which takes tag of clicked element, save's it to global variable and call function from parent window:
public void ChangeApp()
{
switch (MenuValues.panelShowClicked)
{
case 0:
dash.Visibility = Visibility.Visible;
chatApp.Visibility = Visibility.Collapsed;
break;
case 1:
dash.Visibility = Visibility.Collapsed;
chatApp.Visibility = Visibility.Visible;
break;
}
}
The problem is that the visibility of my elements inside the parent window is not changing - no errors or something to work with :(. Can anyone explain? Because when I do MessageBox inside ChangeApp() function with MenuValues.panelShowClicked value MessageBox is shown and value is correct. Idk what is happening.
Thanks a lot!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
