C
C#3y ago
Exilon

Window opacity isn't being affected?

I have a button click method over here that should set a window to opaque:
private void Button_Click_2(object sender, RoutedEventArgs e)
{
if (overlay.thisOverlay != null)
{
overlay.thisOverlay.makeOpaque();
}
}
private void Button_Click_2(object sender, RoutedEventArgs e)
{
if (overlay.thisOverlay != null)
{
overlay.thisOverlay.makeOpaque();
}
}
The method works too. The trace here works:
// This function is in the "overlay" class
public void makeOpaque()
{
this.Opacity = 1;
Trace.WriteLine("Works");
}
// This function is in the "overlay" class
public void makeOpaque()
{
this.Opacity = 1;
Trace.WriteLine("Works");
}
The output shows the message but the opacity of the window doesn't change. What am I doing wrong?
10 Replies
Johnny
Johnny3y ago
Do you want to fade it out? Opacity of 1 means fully visible (to make it fade the value needs to go to 0)
Exilon
ExilonOP3y ago
I want it to fade but right now, I just need it to be fully opaque. Ill figure out the fade myself
Johnny
Johnny3y ago
Set this.Opacity = 1; to this.Opacity = 0;
Exilon
ExilonOP3y ago
Wouldn't that just make the window entirely transparent/ ? Same thing Opacity wont change :/
Johnny
Johnny3y ago
Well, I would probably need some more code
Exilon
ExilonOP3y ago
What would you like to see?
Johnny
Johnny3y ago
Or wait, try 0.5
Exilon
ExilonOP3y ago
Still the same :( What's wierder is that changing other properties work like window state its just opacity
Johnny
Johnny3y ago
hmm
Exilon
ExilonOP3y ago
Definitely wierd

Did you find this page helpful?