zeroo
cant get user control showing after its opened and closed
lowkey needing help i cant get this working once its opened and closed it doesnt open anymore i tried debugging it and it does change the proprities but nothing pops up?
// the settings overlay closer
private void ReturnButton_Click(object sender, RoutedEventArgs e)
{
Debug.WriteLine("recieved initial visibility: " + this.Visibility);
Debug.WriteLine("recieved initial width: " + this.Width);
double targetWidth = 0;
TimeSpan duration = TimeSpan.FromSeconds(0.5);
DoubleAnimation widthAnimation = new DoubleAnimation
{
From = this.ActualWidth,
To = targetWidth,
Duration = new Duration(duration),
EasingFunction = new CubicEase { EasingMode = EasingMode.EaseOut }
};
widthAnimation.Completed += (s, e) =>
{
this.Width = double.NaN;
this.Visibility = Visibility.Hidden;
Debug.WriteLine("closed visibility: " + this.Visibility);
Debug.WriteLine("closed width: " + this.Width);
};
this.BeginAnimation(FrameworkElement.WidthProperty, widthAnimation);
}
}
// the settings overlay closer
private void ReturnButton_Click(object sender, RoutedEventArgs e)
{
Debug.WriteLine("recieved initial visibility: " + this.Visibility);
Debug.WriteLine("recieved initial width: " + this.Width);
double targetWidth = 0;
TimeSpan duration = TimeSpan.FromSeconds(0.5);
DoubleAnimation widthAnimation = new DoubleAnimation
{
From = this.ActualWidth,
To = targetWidth,
Duration = new Duration(duration),
EasingFunction = new CubicEase { EasingMode = EasingMode.EaseOut }
};
widthAnimation.Completed += (s, e) =>
{
this.Width = double.NaN;
this.Visibility = Visibility.Hidden;
Debug.WriteLine("closed visibility: " + this.Visibility);
Debug.WriteLine("closed width: " + this.Width);
};
this.BeginAnimation(FrameworkElement.WidthProperty, widthAnimation);
}
}
private void SettingsButton_Click(object sender, RoutedEventArgs e)
{
if (SettingsOverlay.Visibility == Visibility.Hidden)
{
Debug.WriteLine("Initial visibility: " + SettingsOverlay.Visibility);
SettingsOverlay.Visibility = Visibility.Visible;
SettingsUserControl.Visibility = Visibility.Visible;
SettingsOverlay.Width = 0;
double targetWidth = 450;
TimeSpan duration = TimeSpan.FromSeconds(0.5);
DoubleAnimation widthAnimation = new DoubleAnimation
{
From = 0,
To = targetWidth,
Duration = new Duration(duration),
EasingFunction = new CubicEase { EasingMode = EasingMode.EaseOut }
};
widthAnimation.Completed += (s, e) =>
{
SettingsOverlay.Width = double.NaN;
SettingsOverlay.Visibility = Visibility.Visible;
SettingsUserControl.Visibility = Visibility.Visible;
Debug.WriteLine("opening visibility: " + SettingsOverlay.Visibility);
Debug.WriteLine("opening width: " + SettingsOverlay.Width);
};
SettingsOverlay.BeginAnimation(FrameworkElement.WidthProperty, widthAnimation);
}
}
private void SettingsButton_Click(object sender, RoutedEventArgs e)
{
if (SettingsOverlay.Visibility == Visibility.Hidden)
{
Debug.WriteLine("Initial visibility: " + SettingsOverlay.Visibility);
SettingsOverlay.Visibility = Visibility.Visible;
SettingsUserControl.Visibility = Visibility.Visible;
SettingsOverlay.Width = 0;
double targetWidth = 450;
TimeSpan duration = TimeSpan.FromSeconds(0.5);
DoubleAnimation widthAnimation = new DoubleAnimation
{
From = 0,
To = targetWidth,
Duration = new Duration(duration),
EasingFunction = new CubicEase { EasingMode = EasingMode.EaseOut }
};
widthAnimation.Completed += (s, e) =>
{
SettingsOverlay.Width = double.NaN;
SettingsOverlay.Visibility = Visibility.Visible;
SettingsUserControl.Visibility = Visibility.Visible;
Debug.WriteLine("opening visibility: " + SettingsOverlay.Visibility);
Debug.WriteLine("opening width: " + SettingsOverlay.Width);
};
SettingsOverlay.BeginAnimation(FrameworkElement.WidthProperty, widthAnimation);
}
}
34 replies