public partial class overlay : Window, INotifyPropertyChanged
{
public static overlay? thisOverlay;
DoubleAnimation fade = new DoubleAnimation(0, new Duration(TimeSpan.FromSeconds(5)));
public event PropertyChangedEventHandler? PropertyChanged;
private double _windowOpacity;
public double WindowOpacity
{
get => _windowOpacity;
set
{
if (_windowOpacity == value)
return;
_windowOpacity = value;
OnPropertyChanged();
}
}
public overlay()
{
InitializeComponent();
this.Loaded += Overlay_Loaded;
WindowOpacity = 0.2;
}
private void Overlay_Loaded(object sender, RoutedEventArgs e)
{
thisOverlay = this;
}
protected void OnPropertyChanged([CallerMemberName] string name = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
}
public void setOpacity() // Function is ran outside of this class
{
this.WindowOpacity = 0.5; // This doesn't work
Trace.WriteLine("Works"); // This prints
}
public partial class overlay : Window, INotifyPropertyChanged
{
public static overlay? thisOverlay;
DoubleAnimation fade = new DoubleAnimation(0, new Duration(TimeSpan.FromSeconds(5)));
public event PropertyChangedEventHandler? PropertyChanged;
private double _windowOpacity;
public double WindowOpacity
{
get => _windowOpacity;
set
{
if (_windowOpacity == value)
return;
_windowOpacity = value;
OnPropertyChanged();
}
}
public overlay()
{
InitializeComponent();
this.Loaded += Overlay_Loaded;
WindowOpacity = 0.2;
}
private void Overlay_Loaded(object sender, RoutedEventArgs e)
{
thisOverlay = this;
}
protected void OnPropertyChanged([CallerMemberName] string name = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
}
public void setOpacity() // Function is ran outside of this class
{
this.WindowOpacity = 0.5; // This doesn't work
Trace.WriteLine("Works"); // This prints
}