private void PageChanger(string Page) { DoubleAnimation ServersOpacityAnimation = new DoubleAnimation(); DoubleAnimation ProfileOpacityAnimation = new DoubleAnimation(); BitmapImage BitmapImage = new BitmapImage(); switch (Page) { case "Servers": ServersOpacityAnimation.From = Servers.Opacity; ServersOpacityAnimation.To = 1; ServersOpacityAnimation.Duration = TimeSpan.FromSeconds(0.3); ProfileOpacityAnimation.From = Profile.Opacity; ProfileOpacityAnimation.To = 0; ProfileOpacityAnimation.Duration = TimeSpan.FromSeconds(0.3); Servers.BeginAnimation(Border.OpacityProperty, ServersOpacityAnimation); Profile.BeginAnimation(Border.OpacityProperty, ProfileOpacityAnimation); Servers.Visibility = Visibility.Visible; Profile.Visibility = Visibility.Hidden; Servers.IsEnabled = true; Profile.IsEnabled = false; ControlAvatarImage.Width = 157; ControlAvatarImage.Height = 157; try { BitmapImage.BeginInit(); BitmapImage.UriSource = new Uri(ServersAvatarImageSource); BitmapImage.EndInit(); ControlAvatarImage.Source = BitmapImage; } catch { } break; case "Profile": ServersOpacityAnimation.From = Servers.Opacity; ServersOpacityAnimation.To = 0; ServersOpacityAnimation.Duration = TimeSpan.FromSeconds(0.3); ProfileOpacityAnimation.From = Profile.Opacity; ProfileOpacityAnimation.To = 1; ProfileOpacityAnimation.Duration = TimeSpan.FromSeconds(0.3); Servers.BeginAnimation(Border.OpacityProperty, ServersOpacityAnimation); Profile.BeginAnimation(Border.OpacityProperty, ProfileOpacityAnimation); Servers.Visibility = Visibility.Hidden; Profile.Visibility = Visibility.Visible; Servers.IsEnabled = false; Profile.IsEnabled = true; ControlAvatarImage.Width = 117; ControlAvatarImage.Height = 117; try { BitmapImage.BeginInit(); BitmapImage.UriSource = new Uri(ProfileAvatarImageSource); BitmapImage.EndInit(); ControlAvatarImage.Source = BitmapImage; } catch { } break; } }