private void MakeDataTrigger(Style style) { // Introducing System.Data.Binding, used below to make AttachedProperty Binding var apBinding = new Binding("(local:AttachedProperties.IsHighlighted)") { RelativeSource = RelativeSource.TemplatedParent }; var apDataTrigger = new DataTrigger { Binding = apBinding, Value = true }; apDataTrigger.Setters.Add(new Setter(FrameworkElement.VisibilityProperty, Visibility.Visible)); // Introducing Windows.Media.Animation var sb = new Storyboard(); var colAnim = new ColorAnimation(Colors.Transparent, Colors.Red, TimeSpan.FromMilliseconds(250)); colAnim.AutoReverse = true; colAnim.RepeatBehavior = RepeatBehavior.Forever; Storyboard.SetTargetProperty(colAnim, new PropertyPath("(Background).(SolidColorBrush.Color)")); colAnim.EasingFunction = new CubicEase { EasingMode = EasingMode.EaseOut }; sb.Children.Add(colAnim); var bsb = new BeginStoryboard { Name = "HighlightedAnimation", Storyboard = sb }; apDataTrigger.EnterActions.Add(bsb); apDataTrigger.ExitActions.Add(new StopStoryboard { BeginStoryboardName = "HighlightedAnimation" }); style.Triggers.Add(apDataTrigger); // Next line needed, or causes exception: 'HighlightedAnimation' name cannot be found in the name scope of 'System.Windows.Style'. style.RegisterName("HighlightedAnimation", bsb); }
private EventTrigger Enlarge10x(double height, double width) { // za sirinu DoubleAnimation doubleAnimation = new DoubleAnimation(width, width * 10, new Duration(TimeSpan.FromMilliseconds(800))); doubleAnimation.AutoReverse = true; // vrati na pocetno doubleAnimation.AccelerationRatio = 0.5; // ubzanje Storyboard.SetTargetProperty(doubleAnimation, new PropertyPath("Width")); // za visinu DoubleAnimation doubleAnimation2 = new DoubleAnimation(height, height * 10, new Duration(TimeSpan.FromMilliseconds(800))); doubleAnimation2.AutoReverse = true; Storyboard.SetTargetProperty(doubleAnimation2, new PropertyPath("Height")); Storyboard storyboard = new Storyboard(); storyboard.Children.Add(doubleAnimation); storyboard.Children.Add(doubleAnimation2); BeginStoryboard beginStoryboard = new BeginStoryboard(); beginStoryboard.Storyboard = storyboard; EventTrigger eventTrigger = new EventTrigger(); eventTrigger.RoutedEvent = MouseLeftButtonDownEvent; // na levi klik misa eventTrigger.Actions.Add(beginStoryboard); return(eventTrigger); }
private void Button_Click(object sender, RoutedEventArgs e) { double from = double.Parse(FromVal.Text); double to = double.Parse(ToVal.Text); DoubleAnimation da = new DoubleAnimation(from, to, new Duration(new TimeSpan(0, 0, 1))); da.AutoReverse = true; Storyboard storyboard = new Storyboard(); storyboard.Children.Add(da); Storyboard.SetTargetName(da, Demo3Ellipse.Name); Storyboard.SetTargetProperty(da, new PropertyPath(Ellipse.WidthProperty)); BeginStoryboard bs = new BeginStoryboard(); bs.Storyboard = storyboard; if (Demo3Ellipse.Triggers.Contains(trigger1)) { trigger1.Actions[0] = bs; } else { trigger1 = new EventTrigger(Ellipse.MouseLeftButtonDownEvent); trigger1.Actions.Add(bs); Demo3Ellipse.Triggers.Add(trigger1); } }
private static void OnTraceEnabledChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var triggerBase = d as TriggerBase; if (triggerBase == null) { return; } if (!(e.NewValue is bool)) { return; } if ((bool)e.NewValue) { // insert dummy story-boards which can later be traced using WPF animation tracing if (triggerBase is EventTrigger evTrigger) { var storyboard = new TriggerTraceStoryboard(triggerBase, TriggerTraceStoryboardType.Fire); evTrigger.Actions.Insert(0, new BeginStoryboard() { Storyboard = storyboard }); } else { var storyboard = new TriggerTraceStoryboard(triggerBase, TriggerTraceStoryboardType.Enter); triggerBase.EnterActions.Insert(0, new BeginStoryboard() { Storyboard = storyboard }); storyboard = new TriggerTraceStoryboard(triggerBase, TriggerTraceStoryboardType.Exit); triggerBase.ExitActions.Insert(0, new BeginStoryboard() { Storyboard = storyboard }); } } else { // remove the dummy storyboards foreach (TriggerActionCollection actionCollection in new[] { triggerBase.EnterActions, triggerBase.ExitActions }) { foreach (TriggerAction triggerAction in actionCollection) { BeginStoryboard bsb = triggerAction as BeginStoryboard; if (bsb != null && bsb.Storyboard != null && bsb.Storyboard is TriggerTraceStoryboard) { actionCollection.Remove(bsb); break; } } } } }
public MainWindow() { InitializeComponent(); // Fixes WPF's horrific maximize logic MaxHeight = SystemParameters.MaximizedPrimaryScreenHeight; MaxWidth = SystemParameters.MaximizedPrimaryScreenWidth; var settings = Globals.Container.GetInstance <ISettingsManager <SettingsModel> >().Load(); if (settings.SizeSaving is not null && settings.SizeSaving.IsSavingSize) { this.Height = settings.SizeSaving.Height; this.Width = settings.SizeSaving.Width; } _viewLoaded = FindResource("LoadView") as BeginStoryboard; _viewUnloaded = FindResource("UnloadView") as BeginStoryboard; _mainView = new Main(); NavigatePage(_mainView); // Just to initialize it _nofifyIcon = (TaskbarIcon)FindResource("NotifyIcon"); // Size saving handlers (can't do this in VM) this.SizeChanged += SizeChangedEvent; }
private static void OnAnimationsPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) { if (DesignerProperties.GetIsInDesignMode(sender)) { return; } var destinationElement = sender as FrameworkElement; if (destinationElement == null) { return; } var animationType = (AnimationType)e.NewValue; if (animationType == AnimationType.None) { return; } var obj = GetAnimationResource(animationType); if (obj is AnimationPlaceholder) { var placeholder = obj as AnimationPlaceholder; RoutedEvent routedEvent; var storyboard = ClonePlaceholderItems(placeholder, destinationElement, out routedEvent); var beginStoryboard = new BeginStoryboard(); beginStoryboard.Storyboard = storyboard; var trigger = new EventTrigger(routedEvent); trigger.Actions.Add(beginStoryboard); destinationElement.Triggers.Add(trigger); } }
protected override void InsertItem(int index, Animation anim) { base.InsertItem(index, anim); var trigger = new DataTrigger { Binding = anim.Binding, Value = anim.Value }; var action = new BeginStoryboard { Storyboard = new Storyboard { Children = anim.Children } }; if (anim.Dir == AnimationDir.Enter) { trigger.EnterActions.Add(action); } else { trigger.ExitActions.Add(action); } _style.Triggers.Add(trigger); if (anim.Last) { _control.Style = _style; } }
/// <summary> /// Updates the margin used for animating the Window Title when the window loads. /// </summary> /// <param name="tb">TextBlock which displays the window title</param> /// <param name="margin">New Margin</param> private void UpdateTriggerMargin(TextBlock tb, Thickness margin) { if ((tb.Triggers == null) || (tb.Triggers.Count == 0)) { return; } foreach (EventTrigger trigger in tb.Triggers) { if (trigger.RoutedEvent.Name == "TargetUpdated") { if ((trigger.Actions != null) && (trigger.Actions.Count > 0)) { BeginStoryboard bsb = trigger.Actions[0] as BeginStoryboard; if (bsb != null) { foreach (Timeline timeLine in bsb.Storyboard.Children) { ThicknessAnimation anim = timeLine as ThicknessAnimation; if (anim != null) { Thickness startThickness = new Thickness(margin.Left + 200, margin.Top, margin.Right, margin.Bottom); anim.SetValue(ThicknessAnimation.FromProperty, startThickness); anim.SetValue(ThicknessAnimation.ToProperty, margin); } } } } } } }
private void AddPathAnimation() { EventTrigger et = new EventTrigger(Path.MouseEnterEvent); BeginStoryboard bs = new BeginStoryboard(); ColorAnimation ca = new ColorAnimation { To = Colors.LightBlue, Duration = TimeSpan.FromSeconds(0), AutoReverse = false }; Storyboard.SetTarget(ca, Path); Storyboard.SetTargetProperty(ca, new PropertyPath("Stroke.Color")); bs.Storyboard = new Storyboard(); bs.Storyboard.Children.Add(ca); bs.Storyboard.Completed += (o, e) => { Path.StrokeThickness = _strokePathThickness * 2; }; et.Actions.Add(bs); Path.Triggers.Add(et); et = new EventTrigger(Path.MouseLeaveEvent); bs = new BeginStoryboard(); ca = new ColorAnimation { To = ((SolidColorBrush)Path.Stroke).Color, Duration = TimeSpan.FromSeconds(0), AutoReverse = false }; Storyboard.SetTarget(ca, Path); Storyboard.SetTargetProperty(ca, new PropertyPath("Stroke.Color")); bs.Storyboard = new Storyboard(); bs.Storyboard.Children.Add(ca); bs.Storyboard.Completed += (o, e) => { Path.StrokeThickness = _strokePathThickness; }; et.Actions.Add(bs); Path.Triggers.Add(et); Path.ToolTip = Edge.SourceNode.LabelText + " " + _category + " " + Edge.TargetNode.LabelText; }
private void InitializeAnimation() { var slideInAnimation = new DoubleAnimation(screenWidth, this.Left, new Duration(TimeSpan.FromMilliseconds(300))); Storyboard.SetTargetProperty(slideInAnimation, new PropertyPath("Left")); var fadeOutAnimation = new DoubleAnimationUsingKeyFrames(); fadeOutAnimation.KeyFrames.Add(new SplineDoubleKeyFrame(1, KeyTime.FromTimeSpan(TimeSpan.FromSeconds(3)))); fadeOutAnimation.KeyFrames.Add(new SplineDoubleKeyFrame(0, KeyTime.FromTimeSpan(TimeSpan.FromSeconds(6)))); Storyboard.SetTargetProperty(fadeOutAnimation, new PropertyPath("Opacity")); var windowStoryboard = new Storyboard(); windowStoryboard.Completed += WindowStoryboard_Completed; windowStoryboard.Children.Add(slideInAnimation); windowStoryboard.Children.Add(fadeOutAnimation); var windowEventTrigger = new EventTrigger(); var windowBeginStoryboard = new BeginStoryboard(); windowEventTrigger.RoutedEvent = Window.LoadedEvent; windowBeginStoryboard.Storyboard = windowStoryboard; windowEventTrigger.Actions.Add(windowBeginStoryboard); WallpaperNotification.Triggers.Add(windowEventTrigger); }
private void InitializeStartingStorybyard() { double scale = 15; TimeSpan appearDuration = new TimeSpan(0, 0, 0, 0, 300); _startingStoryboard = new BeginStoryboard(); _startingStoryboard.Storyboard = new Storyboard(); DoubleAnimation anim1 = new DoubleAnimation(); anim1.From = SystemParameters.PrimaryScreenWidth; anim1.To = SystemParameters.PrimaryScreenWidth / 2 - this.Width / 2; anim1.Duration = appearDuration; _startingStoryboard.Storyboard.Children.Add(anim1); Storyboard.SetTargetProperty(anim1, new PropertyPath(Canvas.LeftProperty)); Storyboard.SetTarget(anim1, C_OsuNode); //ellipse DoubleAnimation anim2 = new DoubleAnimation(); anim2.To = C_Ellipse.Width; anim2.From = scale; anim2.AutoReverse = false; anim2.Duration = appearDuration; _startingStoryboard.Storyboard.Children.Add(anim2); Storyboard.SetTargetProperty(anim2, new PropertyPath(UserControl.WidthProperty)); Storyboard.SetTarget(anim2, C_Ellipse); DoubleAnimation anim3 = new DoubleAnimation(); anim3.To = C_Ellipse.Height; anim3.From = scale; anim3.AutoReverse = false; anim3.Duration = appearDuration; _startingStoryboard.Storyboard.Children.Add(anim3); Storyboard.SetTargetProperty(anim3, new PropertyPath(UserControl.HeightProperty)); Storyboard.SetTarget(anim3, C_Ellipse); //ellipse pulse DoubleAnimation anim_ep = new DoubleAnimation(); anim_ep.To = C_Ellipse_Pulse.Width; anim_ep.From = scale; anim_ep.AutoReverse = false; anim_ep.Duration = appearDuration; _startingStoryboard.Storyboard.Children.Add(anim_ep); Storyboard.SetTargetProperty(anim_ep, new PropertyPath(UserControl.WidthProperty)); Storyboard.SetTarget(anim_ep, C_Ellipse_Pulse); DoubleAnimation anim_ep2 = new DoubleAnimation(); anim_ep2.To = C_Ellipse_Pulse.Height; anim_ep2.From = scale; anim_ep2.AutoReverse = false; anim_ep2.Duration = appearDuration; _startingStoryboard.Storyboard.Children.Add(anim_ep2); Storyboard.SetTargetProperty(anim_ep2, new PropertyPath(UserControl.HeightProperty)); Storyboard.SetTarget(anim_ep2, C_Ellipse_Pulse); }
public override void Execute(UIElement element) { BeginStoryboard beginStoryboard = FindStoryboard(element); if (beginStoryboard != null) { element.StopStoryboard(beginStoryboard.Storyboard); } }
public Turntable1200View() { InitializeComponent(); ///Grab the storyboards from the control beginVinylStoryboard = (BeginStoryboard)FindResource("RotateVinyl_Begin"); beginVinylImageStoryboard = (BeginStoryboard)FindResource("RotateVinylImage_Begin"); this.Loaded += Turntable1200View_Loaded; }
//<SnippetUIElementRenderTransformOrigin> public RotateAboutCenterExample() { this.WindowTitle = "Rotate About Center Example"; NameScope.SetNameScope(this, new NameScope()); StackPanel myStackPanel = new StackPanel(); myStackPanel.Margin = new Thickness(50); Button myButton = new Button(); myButton.Name = "myRenderTransformButton"; this.RegisterName(myButton.Name, myButton); myButton.RenderTransformOrigin = new Point(0.5, 0.5); myButton.HorizontalAlignment = HorizontalAlignment.Left; myButton.Content = "Hello World"; RotateTransform myRotateTransform = new RotateTransform(0); myButton.RenderTransform = myRotateTransform; this.RegisterName("MyAnimatedTransform", myRotateTransform); myStackPanel.Children.Add(myButton); // // Creates an animation that accelerates through 40% of its duration and // decelerates through the 60% of its duration. // DoubleAnimation myRotateAboutCenterAnimation = new DoubleAnimation(); Storyboard.SetTargetName(myRotateAboutCenterAnimation, "MyAnimatedTransform"); Storyboard.SetTargetProperty(myRotateAboutCenterAnimation, new PropertyPath(RotateTransform.AngleProperty)); myRotateAboutCenterAnimation.From = 0.0; myRotateAboutCenterAnimation.To = 360; myRotateAboutCenterAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(1000)); // Create a Storyboard to contain the animations and // add the animations to the Storyboard. Storyboard myStoryboard = new Storyboard(); myStoryboard.Children.Add(myRotateAboutCenterAnimation); // Create an EventTrigger and a BeginStoryboard action to // start the storyboard. EventTrigger myEventTrigger = new EventTrigger(); myEventTrigger.RoutedEvent = Button.ClickEvent; myEventTrigger.SourceName = myButton.Name; BeginStoryboard myBeginStoryboard = new BeginStoryboard(); myBeginStoryboard.Storyboard = myStoryboard; myEventTrigger.Actions.Add(myBeginStoryboard); myStackPanel.Triggers.Add(myEventTrigger); this.Content = myStackPanel; }
private CustomMessage() { this.InitializeComponent(); this.showMessageAnim = this.FindResource("MessageShowAnimation") as BeginStoryboard; this.showMessageAnim.Storyboard.Completed += this.OnShowMessageAnimCompleted; this.InfoIcon.Visibility = Visibility.Hidden; this.ErrorIcon.Visibility = Visibility.Hidden; this.DoneIcon.Visibility = Visibility.Hidden; }
private void BrushTargetingExample() { // <Snippet137> // Create a name scope for the page. NameScope.SetNameScope(this, new NameScope()); Rectangle rectangle01 = new Rectangle(); rectangle01.Name = "Rectangle01"; this.RegisterName(rectangle01.Name, rectangle01); rectangle01.Width = 100; rectangle01.Height = 100; rectangle01.Fill = (SolidColorBrush)this.Resources["MySolidColorBrushResource"]; ColorAnimation myColorAnimation = new ColorAnimation(); myColorAnimation.From = Colors.Blue; myColorAnimation.To = Colors.AliceBlue; myColorAnimation.Duration = new Duration(TimeSpan.FromSeconds(1)); Storyboard.SetTargetName(myColorAnimation, rectangle01.Name); // <Snippet134> // <Snippet135> // <SnippetPropertyChainAndPath> DependencyProperty[] propertyChain = new DependencyProperty[] { Rectangle.FillProperty, SolidColorBrush.ColorProperty }; // </Snippet135> // <Snippet136> string thePath = "(0).(1)"; // </Snippet136> // </SnippetPropertyChainAndPath> PropertyPath myPropertyPath = new PropertyPath(thePath, propertyChain); Storyboard.SetTargetProperty(myColorAnimation, myPropertyPath); // </Snippet134> Storyboard myStoryboard = new Storyboard(); myStoryboard.Children.Add(myColorAnimation); BeginStoryboard myBeginStoryboard = new BeginStoryboard(); myBeginStoryboard.Storyboard = myStoryboard; EventTrigger myMouseEnterTrigger = new EventTrigger(); myMouseEnterTrigger.RoutedEvent = Rectangle.MouseEnterEvent; myMouseEnterTrigger.Actions.Add(myBeginStoryboard); rectangle01.Triggers.Add(myMouseEnterTrigger); // </Snippet137> myStackPanel.Children.Add(rectangle01); }
private void Button_Click_1(object sender, RoutedEventArgs e) { // https://www.youtube.com/watch?v=mSMfLTAYRho BeginStoryboard bs = new BeginStoryboard(); bs.Storyboard = Resources["DemoStoryBoard"] as Storyboard; trigger2 = new EventTrigger(Ellipse.PreviewMouseLeftButtonDownEvent); trigger2.Actions.Add(bs); Demo3Ellipse.Triggers.Add(trigger2); }
private void CollectionTargetingExample() { // <Snippet138> Rectangle rectangle02 = new Rectangle(); rectangle02.Name = "Rectangle02"; this.RegisterName(rectangle02.Name, rectangle02); rectangle02.Width = 100; rectangle02.Height = 100; rectangle02.Fill = Brushes.Blue; rectangle02.RenderTransform = (TransformGroup)this.Resources["MyTransformGroupResource"]; DoubleAnimation myDoubleAnimation = new DoubleAnimation(); myDoubleAnimation.From = 0; myDoubleAnimation.To = 360; myDoubleAnimation.Duration = new Duration(TimeSpan.FromSeconds(1)); Storyboard.SetTargetName(myDoubleAnimation, rectangle02.Name); // <Snippet139> // <Snippet140> DependencyProperty[] propertyChain = new DependencyProperty[] { Rectangle.RenderTransformProperty, TransformGroup.ChildrenProperty, RotateTransform.AngleProperty }; // </Snippet140> // <Snippet141> string thePath = "(0).(1)[1].(2)"; // </Snippet141> PropertyPath myPropertyPath = new PropertyPath(thePath, propertyChain); Storyboard.SetTargetProperty(myDoubleAnimation, myPropertyPath); // </Snippet139> Storyboard myStoryboard = new Storyboard(); myStoryboard.Children.Add(myDoubleAnimation); BeginStoryboard myBeginStoryboard = new BeginStoryboard(); myBeginStoryboard.Storyboard = myStoryboard; EventTrigger myMouseEnterTrigger = new EventTrigger(); myMouseEnterTrigger.RoutedEvent = Rectangle.MouseEnterEvent; myMouseEnterTrigger.Actions.Add(myBeginStoryboard); rectangle02.Triggers.Add(myMouseEnterTrigger); // </Snippet138> myStackPanel.Children.Add(rectangle02); }
public void SetStackPanelStyle(ref Border bdr, double InneraActualHeight) { DoubleAnimation daShowHeight = new DoubleAnimation(5, InneraActualHeight, TimeSpan.FromSeconds(0.5), FillBehavior.HoldEnd); DoubleAnimation daHideHeight = new DoubleAnimation(bdr.ActualHeight, 5, TimeSpan.FromSeconds(0.5), FillBehavior.HoldEnd); Storyboard sbHide = new Storyboard(); Storyboard sbShow = new Storyboard(); sbHide.BeginTime = TimeSpan.FromSeconds(1); sbShow.BeginTime = TimeSpan.FromSeconds(0.5); BeginStoryboard bsdShow = new BeginStoryboard(); BeginStoryboard bsdHide = new BeginStoryboard(); bsdHide.HandoffBehavior = HandoffBehavior.Compose; bsdShow.HandoffBehavior = HandoffBehavior.Compose; EventTrigger etShow = new EventTrigger(); EventTrigger etHide = new EventTrigger(); Storyboard.SetTargetProperty(daShowHeight, new PropertyPath(StackPanel.HeightProperty)); Storyboard.SetTargetProperty(daHideHeight, new PropertyPath(StackPanel.HeightProperty)); sbHide.Children.Add(daHideHeight); sbShow.Children.Add(daShowHeight); bsdHide.Storyboard = sbHide; bsdShow.Storyboard = sbShow; etShow.RoutedEvent = Mouse.MouseUpEvent; etHide.RoutedEvent = Mouse.MouseLeaveEvent; etShow.Actions.Add(bsdShow); etHide.Actions.Add(bsdHide); Style style = new Style(); style.Triggers.Add(etShow); style.Triggers.Add(etHide); bdr.Style = style; }
private static void _OnAttachStoryboardChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { FrameworkElement target = (FrameworkElement)d; AttachStoryboard attachStoryboard = (AttachStoryboard)e.NewValue; if (attachStoryboard != null) { BeginStoryboard beginStoryboard = new BeginStoryboard { Storyboard = attachStoryboard.Storyboard }; EventTrigger trigger = new EventTrigger(attachStoryboard.Trigger); trigger.Actions.Add(beginStoryboard); attachStoryboard.Storyboard.Completed += (sender, e1) => attachStoryboard.RaiseCompleted(); target.Triggers.Add(trigger); } }
private EventTrigger CloseAnimation(RoutedEvent RE) { EventTrigger eventTrigger = new EventTrigger(RE); BeginStoryboard beginStoryBoard = new BeginStoryboard(); Storyboard storyBoard = new Storyboard(); DoubleAnimation doubleAnimation = new DoubleAnimation(); doubleAnimation.From = panelHeight; doubleAnimation.To = 0; doubleAnimation.Duration = new Duration(new TimeSpan(5000000)); Storyboard.SetTargetName(doubleAnimation, "spPanel"); Storyboard.SetTargetProperty(doubleAnimation, new PropertyPath("(StackPanel.Height)")); storyBoard.Children.Add(doubleAnimation); beginStoryBoard.Storyboard = storyBoard; eventTrigger.Actions.Add(beginStoryBoard); return(eventTrigger); }
public RectangleOpacityFadeExample() { NameScope.SetNameScope(this, new NameScope()); this.WindowTitle = "Fading Rectangle Example"; StackPanel myPanel = new StackPanel(); myPanel.Margin = new Thickness(10); Rectangle myRectangle = new Rectangle(); myRectangle.Name = "myRectangle"; this.RegisterName(myRectangle.Name, myRectangle); myRectangle.Width = 100; myRectangle.Height = 100; myRectangle.Fill = Brushes.Blue; DoubleAnimation myDoubleAnimation = new DoubleAnimation(); myDoubleAnimation.From = 1.0; myDoubleAnimation.To = 0.0; myDoubleAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(5000)); myDoubleAnimation.AutoReverse = true; myDoubleAnimation.RepeatBehavior = RepeatBehavior.Forever; Storyboard myStoryboard = new Storyboard(); myStoryboard.Children.Add(myDoubleAnimation); Storyboard.SetTargetName(myDoubleAnimation, myRectangle.Name); Storyboard.SetTargetProperty(myDoubleAnimation, new PropertyPath(Rectangle.OpacityProperty)); BeginStoryboard myBeginStoryboard = new BeginStoryboard(); myBeginStoryboard.Storyboard = myStoryboard; EventTrigger myLoadedEventTrigger = new EventTrigger(); myLoadedEventTrigger.RoutedEvent = Rectangle.LoadedEvent; myLoadedEventTrigger.Actions.Add(myBeginStoryboard); myRectangle.Triggers.Add(myLoadedEventTrigger); myPanel.Children.Add(myRectangle); this.Content = myPanel; }
public SpinnerImage() { this.Source = new BitmapImage(new Uri("pack://application:,,,/WpfEmptyApp;component/searchx64.png")); this.Name = "Spinner"; this.Width = 64; this.Height = 64; NameScope.SetNameScope(this, new NameScope()); RotateTransform myRotateTransform = new RotateTransform(0); this.RenderTransform = myRotateTransform; this.RenderTransformOrigin = new Point(0.5, 0.5); this.RegisterName("MyAnimatedTransform", myRotateTransform); DoubleAnimation myRotateAboutCenterAnimation = new DoubleAnimation(); Storyboard.SetTargetName(myRotateAboutCenterAnimation, "MyAnimatedTransform"); Storyboard.SetTargetProperty(myRotateAboutCenterAnimation, new PropertyPath(RotateTransform.AngleProperty)); myRotateAboutCenterAnimation.From = 0.0; myRotateAboutCenterAnimation.By = 10; myRotateAboutCenterAnimation.To = 360; myRotateAboutCenterAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(1000)); myRotateAboutCenterAnimation.RepeatBehavior = RepeatBehavior.Forever; // Create a Storyboard to contain the animations and // add the animations to the Storyboard. Storyboard myStoryboard = new Storyboard(); myStoryboard.Children.Add(myRotateAboutCenterAnimation); // Create an EventTrigger and a BeginStoryboard action to // start the storyboard. EventTrigger myEventTrigger = new EventTrigger(); myEventTrigger.RoutedEvent = FrameworkElement.LoadedEvent; myEventTrigger.SourceName = Name; BeginStoryboard myBeginStoryboard = new BeginStoryboard(); myBeginStoryboard.Storyboard = myStoryboard; myEventTrigger.Actions.Add(myBeginStoryboard); this.Triggers.Add(myEventTrigger); }
public static void SetButtonDoubleAnimation(FrameworkElement control, EasingMode easingMode, RoutedEvent mouseEvent, double animateTo, string[] properties) { EventTrigger trigger = new EventTrigger(mouseEvent); control.Triggers.Add(trigger); BeginStoryboard beginStoryBoard = new BeginStoryboard(); trigger.Actions.Add(beginStoryBoard); Storyboard storyboard = new Storyboard(); beginStoryBoard.Storyboard = storyboard; foreach (string property in properties) { DoubleAnimation da = CreateExponentialAnimation(easingMode, animateTo, 250, storyboard, false); storyboard.Children.Add(da); Storyboard.SetTargetProperty(da, new PropertyPath(property)); } }
private static MediaElement CreateMediaElement(Uri uri) { // All this to make a video loop var mediaTimeline = new MediaTimeline { Source = uri, RepeatBehavior = RepeatBehavior.Forever, }; var storyboard = new Storyboard(); storyboard.Children.Add(mediaTimeline); var beginStoryboard = new BeginStoryboard { Storyboard = storyboard }; var eventTrigger = new EventTrigger { RoutedEvent = FrameworkElement.LoadedEvent }; eventTrigger.Actions.Add(beginStoryboard); var mediaElement = new MediaElement(); mediaElement.Triggers.Add(eventTrigger); mediaElement.MediaOpened += (sender, args) => Task .Delay(TimeSpan.FromMilliseconds(100)) .ContinueWith(t => mediaElement.Dispatcher.Invoke(() => CopyUIElementToClipboard(mediaElement))); mediaElement.MediaFailed += (sender, args) => { ((Popup)((Border)mediaElement.Parent).Parent).IsOpen = false; mediaElement.Dispatcher.Invoke(() => MessageBox.Show(args.ErrorException.Message, "Tweetz")); }; return(mediaElement); }
public static void AddDataTriggerST(Style style, Storyboard st, object souce, string path, object value) { string guid = "B" + GetGuid().Replace("-", ""); DataTrigger data = new DataTrigger(); BeginStoryboard beginst = new BeginStoryboard() { Storyboard = st, Name = guid }; data.Binding = new Binding(path) { Source = souce, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; style.RegisterName(guid, beginst); data.Value = value; data.EnterActions.Add(beginst); data.ExitActions.Add(new StopStoryboard() { BeginStoryboardName = guid }); style.Triggers.Add(data); }
private void InitializeAnimation() { var slideInAnimation = new DoubleAnimation(screenWidth, this.Left, new Duration(TimeSpan.FromMilliseconds(200))); Storyboard.SetTargetProperty(slideInAnimation, new PropertyPath("Left")); var slideOutAnimation = new DoubleAnimationUsingKeyFrames(); slideOutAnimation.KeyFrames.Add(new SplineDoubleKeyFrame(this.Left, KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(1800)))); slideOutAnimation.KeyFrames.Add(new SplineDoubleKeyFrame(screenWidth, KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(2000)))); Storyboard.SetTargetProperty(slideOutAnimation, new PropertyPath("Left")); var windowStoryboard = new Storyboard(); windowStoryboard.Completed += WindowStoryboard_Completed; windowStoryboard.Children.Add(slideInAnimation); windowStoryboard.Children.Add(slideOutAnimation); var windowEventTrigger = new EventTrigger(); var windowBeginStoryboard = new BeginStoryboard(); windowBeginStoryboard.Storyboard = windowStoryboard; this.BeginStoryboard(windowStoryboard); }
private static System.Collections.ObjectModel.ObservableCollection<object> Get_TabControl_Items() { System.Collections.ObjectModel.ObservableCollection<object> items = new System.Collections.ObjectModel.ObservableCollection<object>(); // e_3 element TabItem e_3 = new TabItem(); e_3.Name = "e_3"; e_3.HorizontalContentAlignment = HorizontalAlignment.Stretch; e_3.Header = "Controls"; // e_4 element Grid e_4 = new Grid(); e_3.Content = e_4; e_4.Name = "e_4"; RowDefinition row_e_4_0 = new RowDefinition(); row_e_4_0.Height = new GridLength(1F, GridUnitType.Auto); e_4.RowDefinitions.Add(row_e_4_0); RowDefinition row_e_4_1 = new RowDefinition(); row_e_4_1.Height = new GridLength(1F, GridUnitType.Auto); e_4.RowDefinitions.Add(row_e_4_1); RowDefinition row_e_4_2 = new RowDefinition(); row_e_4_2.Height = new GridLength(1F, GridUnitType.Auto); e_4.RowDefinitions.Add(row_e_4_2); RowDefinition row_e_4_3 = new RowDefinition(); row_e_4_3.Height = new GridLength(1F, GridUnitType.Auto); e_4.RowDefinitions.Add(row_e_4_3); RowDefinition row_e_4_4 = new RowDefinition(); row_e_4_4.Height = new GridLength(1F, GridUnitType.Auto); e_4.RowDefinitions.Add(row_e_4_4); RowDefinition row_e_4_5 = new RowDefinition(); row_e_4_5.Height = new GridLength(1F, GridUnitType.Auto); e_4.RowDefinitions.Add(row_e_4_5); RowDefinition row_e_4_6 = new RowDefinition(); row_e_4_6.Height = new GridLength(1F, GridUnitType.Auto); e_4.RowDefinitions.Add(row_e_4_6); RowDefinition row_e_4_7 = new RowDefinition(); row_e_4_7.Height = new GridLength(1F, GridUnitType.Auto); e_4.RowDefinitions.Add(row_e_4_7); RowDefinition row_e_4_8 = new RowDefinition(); row_e_4_8.Height = new GridLength(1F, GridUnitType.Auto); e_4.RowDefinitions.Add(row_e_4_8); RowDefinition row_e_4_9 = new RowDefinition(); row_e_4_9.Height = new GridLength(1F, GridUnitType.Auto); e_4.RowDefinitions.Add(row_e_4_9); ColumnDefinition col_e_4_0 = new ColumnDefinition(); col_e_4_0.Width = new GridLength(1F, GridUnitType.Auto); e_4.ColumnDefinitions.Add(col_e_4_0); ColumnDefinition col_e_4_1 = new ColumnDefinition(); e_4.ColumnDefinitions.Add(col_e_4_1); // e_5 element TextBlock e_5 = new TextBlock(); e_4.Children.Add(e_5); e_5.Name = "e_5"; e_5.VerticalAlignment = VerticalAlignment.Center; e_5.Text = "Button"; // button1 element Button button1 = new Button(); e_4.Children.Add(button1); button1.Name = "button1"; button1.Height = 30F; button1.Width = 200F; button1.Margin = new Thickness(5F, 5F, 5F, 5F); button1.HorizontalAlignment = HorizontalAlignment.Left; button1.TabIndex = 1; button1.Content = "Button 1"; button1.CommandParameter = "Click Button 1"; Grid.SetColumn(button1, 1); Grid.SetRow(button1, 0); Binding binding_button1_Command = new Binding("ButtonCommand"); button1.SetBinding(Button.CommandProperty, binding_button1_Command); // button2 element Button button2 = new Button(); e_4.Children.Add(button2); button2.Name = "button2"; button2.Height = 30F; button2.Width = 200F; button2.Margin = new Thickness(5F, 5F, 5F, 5F); button2.HorizontalAlignment = HorizontalAlignment.Left; button2.TabIndex = 2; button2.Content = "Button 2"; button2.CommandParameter = "Click Button 2"; Grid.SetColumn(button2, 1); Grid.SetRow(button2, 1); Binding binding_button2_IsEnabled = new Binding("ButtonEnabled"); button2.SetBinding(Button.IsEnabledProperty, binding_button2_IsEnabled); Binding binding_button2_Command = new Binding("ButtonCommand"); button2.SetBinding(Button.CommandProperty, binding_button2_Command); // buttonResult element TextBlock buttonResult = new TextBlock(); e_4.Children.Add(buttonResult); buttonResult.Name = "buttonResult"; buttonResult.HorizontalAlignment = HorizontalAlignment.Left; Grid.SetColumn(buttonResult, 1); Grid.SetRow(buttonResult, 2); Binding binding_buttonResult_Text = new Binding("ButtonResult"); buttonResult.SetBinding(TextBlock.TextProperty, binding_buttonResult_Text); // e_6 element TextBlock e_6 = new TextBlock(); e_4.Children.Add(e_6); e_6.Name = "e_6"; e_6.VerticalAlignment = VerticalAlignment.Center; e_6.Text = "CheckBox"; Grid.SetRow(e_6, 3); // checkBox element CheckBox checkBox = new CheckBox(); e_4.Children.Add(checkBox); checkBox.Name = "checkBox"; checkBox.Margin = new Thickness(5F, 5F, 5F, 5F); checkBox.HorizontalAlignment = HorizontalAlignment.Left; checkBox.TabIndex = 3; checkBox.Content = "Check Box"; Grid.SetColumn(checkBox, 1); Grid.SetRow(checkBox, 3); // e_7 element TextBlock e_7 = new TextBlock(); e_4.Children.Add(e_7); e_7.Name = "e_7"; e_7.VerticalAlignment = VerticalAlignment.Center; e_7.Text = "ProgressBar"; Grid.SetRow(e_7, 4); // e_8 element ProgressBar e_8 = new ProgressBar(); e_4.Children.Add(e_8); e_8.Name = "e_8"; e_8.Height = 30F; e_8.Width = 200F; e_8.Margin = new Thickness(5F, 5F, 5F, 5F); e_8.HorizontalAlignment = HorizontalAlignment.Left; Grid.SetColumn(e_8, 1); Grid.SetRow(e_8, 4); Binding binding_e_8_Value = new Binding("ProgressValue"); e_8.SetBinding(ProgressBar.ValueProperty, binding_e_8_Value); // e_9 element TextBlock e_9 = new TextBlock(); e_4.Children.Add(e_9); e_9.Name = "e_9"; e_9.VerticalAlignment = VerticalAlignment.Center; e_9.Text = "Slider"; Grid.SetRow(e_9, 5); // slider element Slider slider = new Slider(); e_4.Children.Add(slider); slider.Name = "slider"; slider.Width = 200F; slider.HorizontalAlignment = HorizontalAlignment.Left; slider.TabIndex = 4; slider.Minimum = 5F; slider.Maximum = 20F; Grid.SetColumn(slider, 1); Grid.SetRow(slider, 5); Binding binding_slider_Value = new Binding("SliderValue"); slider.SetBinding(Slider.ValueProperty, binding_slider_Value); // e_10 element TextBlock e_10 = new TextBlock(); e_4.Children.Add(e_10); e_10.Name = "e_10"; e_10.VerticalAlignment = VerticalAlignment.Center; e_10.Text = "TextBox"; Grid.SetRow(e_10, 6); // textBox element TextBox textBox = new TextBox(); e_4.Children.Add(textBox); textBox.Name = "textBox"; textBox.Width = 200F; textBox.Margin = new Thickness(5F, 5F, 5F, 5F); textBox.HorizontalAlignment = HorizontalAlignment.Left; textBox.TabIndex = 5; Grid.SetColumn(textBox, 1); Grid.SetRow(textBox, 6); Binding binding_textBox_Text = new Binding("TextBoxText"); textBox.SetBinding(TextBox.TextProperty, binding_textBox_Text); // e_11 element TextBlock e_11 = new TextBlock(); e_4.Children.Add(e_11); e_11.Name = "e_11"; e_11.VerticalAlignment = VerticalAlignment.Center; e_11.Text = "PasswordBox"; Grid.SetRow(e_11, 7); // e_12 element PasswordBox e_12 = new PasswordBox(); e_4.Children.Add(e_12); e_12.Name = "e_12"; e_12.Width = 200F; e_12.Margin = new Thickness(5F, 5F, 5F, 5F); e_12.HorizontalAlignment = HorizontalAlignment.Left; e_12.TabIndex = 6; Grid.SetColumn(e_12, 1); Grid.SetRow(e_12, 7); // e_13 element TextBlock e_13 = new TextBlock(); e_4.Children.Add(e_13); e_13.Name = "e_13"; e_13.VerticalAlignment = VerticalAlignment.Center; e_13.Text = "ComboBox"; Grid.SetRow(e_13, 8); // combo element ComboBox combo = new ComboBox(); e_4.Children.Add(combo); combo.Name = "combo"; combo.Width = 200F; combo.Margin = new Thickness(5F, 5F, 5F, 5F); combo.HorizontalAlignment = HorizontalAlignment.Left; combo.TabIndex = 7; combo.ItemsSource = Get_combo_Items(); combo.SelectedIndex = 2; Grid.SetColumn(combo, 1); Grid.SetRow(combo, 8); // e_14 element TextBlock e_14 = new TextBlock(); e_4.Children.Add(e_14); e_14.Name = "e_14"; e_14.VerticalAlignment = VerticalAlignment.Center; e_14.Text = "ListBox"; Grid.SetRow(e_14, 9); // e_15 element ListBox e_15 = new ListBox(); e_4.Children.Add(e_15); e_15.Name = "e_15"; e_15.TabIndex = 8; e_15.ItemsSource = Get_e_15_Items(); Grid.SetColumn(e_15, 1); Grid.SetRow(e_15, 9); items.Add(e_3); // e_22 element TabItem e_22 = new TabItem(); e_22.Name = "e_22"; e_22.Header = "DataGrid"; // e_23 element DataGrid e_23 = new DataGrid(); e_22.Content = e_23; e_23.Name = "e_23"; e_23.AutoGenerateColumns = false; DataGridTextColumn e_23_Col0 = new DataGridTextColumn(); e_23_Col0.Header = "#"; Binding e_23_Col0_b = new Binding("Number"); e_23_Col0.Binding = e_23_Col0_b; e_23.Columns.Add(e_23_Col0); DataGridTextColumn e_23_Col1 = new DataGridTextColumn(); e_23_Col1.Header = "Text"; Style e_23_Col1_e_s = new Style(typeof(DataGridCell)); Setter e_23_Col1_e_s_S_0 = new Setter(DataGridCell.BackgroundProperty, new SolidColorBrush(new ColorW(128, 128, 128, 255))); e_23_Col1_e_s.Setters.Add(e_23_Col1_e_s_S_0); Setter e_23_Col1_e_s_S_1 = new Setter(DataGridCell.HorizontalAlignmentProperty, HorizontalAlignment.Center); e_23_Col1_e_s.Setters.Add(e_23_Col1_e_s_S_1); Setter e_23_Col1_e_s_S_2 = new Setter(DataGridCell.VerticalAlignmentProperty, VerticalAlignment.Center); e_23_Col1_e_s.Setters.Add(e_23_Col1_e_s_S_2); e_23_Col1.ElementStyle = e_23_Col1_e_s; Binding e_23_Col1_b = new Binding("Text"); e_23_Col1.Binding = e_23_Col1_b; e_23.Columns.Add(e_23_Col1); DataGridCheckBoxColumn e_23_Col2 = new DataGridCheckBoxColumn(); e_23_Col2.Header = "Bool"; Binding e_23_Col2_b = new Binding("Boolean"); e_23_Col2.Binding = e_23_Col2_b; e_23.Columns.Add(e_23_Col2); DataGridTemplateColumn e_23_Col3 = new DataGridTemplateColumn(); e_23_Col3.Width = 200F; // e_24 element TextBlock e_24 = new TextBlock(); e_24.Name = "e_24"; e_24.Text = "Template Column"; e_23_Col3.Header = e_24; Style e_23_Col3_h_s = new Style(typeof(DataGridColumnHeader)); Setter e_23_Col3_h_s_S_0 = new Setter(DataGridColumnHeader.ForegroundProperty, new SolidColorBrush(new ColorW(255, 165, 0, 255))); e_23_Col3_h_s.Setters.Add(e_23_Col3_h_s_S_0); e_23_Col3.HeaderStyle = e_23_Col3_h_s; Func<UIElement, UIElement> e_23_Col3_ct_dtFunc = e_23_Col3_ct_dtMethod; e_23_Col3.CellTemplate = new DataTemplate(e_23_Col3_ct_dtFunc); e_23.Columns.Add(e_23_Col3); Binding binding_e_23_ItemsSource = new Binding("GridData"); e_23.SetBinding(DataGrid.ItemsSourceProperty, binding_e_23_ItemsSource); items.Add(e_22); // e_30 element TabItem e_30 = new TabItem(); e_30.Name = "e_30"; e_30.Header = "TreeView"; // e_31 element TreeView e_31 = new TreeView(); e_30.Content = e_31; e_31.Name = "e_31"; Binding binding_e_31_ItemsSource = new Binding("TreeItems"); e_31.SetBinding(TreeView.ItemsSourceProperty, binding_e_31_ItemsSource); items.Add(e_30); // e_32 element TabItem e_32 = new TabItem(); e_32.Name = "e_32"; e_32.Header = "Shapes"; // e_33 element Grid e_33 = new Grid(); e_32.Content = e_33; e_33.Name = "e_33"; RowDefinition row_e_33_0 = new RowDefinition(); e_33.RowDefinitions.Add(row_e_33_0); RowDefinition row_e_33_1 = new RowDefinition(); e_33.RowDefinitions.Add(row_e_33_1); RowDefinition row_e_33_2 = new RowDefinition(); e_33.RowDefinitions.Add(row_e_33_2); ColumnDefinition col_e_33_0 = new ColumnDefinition(); e_33.ColumnDefinitions.Add(col_e_33_0); ColumnDefinition col_e_33_1 = new ColumnDefinition(); e_33.ColumnDefinitions.Add(col_e_33_1); ColumnDefinition col_e_33_2 = new ColumnDefinition(); e_33.ColumnDefinitions.Add(col_e_33_2); // e_34 element Rectangle e_34 = new Rectangle(); e_33.Children.Add(e_34); e_34.Name = "e_34"; e_34.Height = 100F; e_34.Width = 200F; e_34.Margin = new Thickness(5F, 5F, 5F, 5F); e_34.Fill = new SolidColorBrush(new ColorW(0, 128, 0, 255)); e_34.Stroke = new SolidColorBrush(new ColorW(128, 128, 128, 255)); e_34.StrokeThickness = 5F; e_34.RadiusX = 10F; e_34.RadiusY = 10F; // e_35 element Rectangle e_35 = new Rectangle(); e_33.Children.Add(e_35); e_35.Name = "e_35"; e_35.Height = 100F; e_35.Width = 200F; e_35.Margin = new Thickness(5F, 5F, 5F, 5F); e_35.Fill = new SolidColorBrush(new ColorW(255, 165, 0, 255)); Grid.SetColumn(e_35, 1); // e_36 element Rectangle e_36 = new Rectangle(); e_33.Children.Add(e_36); e_36.Name = "e_36"; e_36.Height = 100F; e_36.Width = 200F; e_36.Margin = new Thickness(5F, 5F, 5F, 5F); LinearGradientBrush e_36_Fill = new LinearGradientBrush(); e_36_Fill.StartPoint = new PointF(0F, 0F); e_36_Fill.EndPoint = new PointF(1F, 1F); e_36_Fill.SpreadMethod = GradientSpreadMethod.Pad; e_36_Fill.GradientStops.Add(new GradientStop(new ColorW(255, 165, 0, 255), 0.5F)); e_36_Fill.GradientStops.Add(new GradientStop(new ColorW(0, 162, 255, 255), 0F)); e_36.Fill = e_36_Fill; LinearGradientBrush e_36_Stroke = new LinearGradientBrush(); e_36_Stroke.StartPoint = new PointF(0F, 0F); e_36_Stroke.EndPoint = new PointF(1F, 1F); e_36_Stroke.SpreadMethod = GradientSpreadMethod.Pad; e_36_Stroke.GradientStops.Add(new GradientStop(new ColorW(0, 162, 255, 255), 0.5F)); e_36_Stroke.GradientStops.Add(new GradientStop(new ColorW(255, 165, 0, 255), 0F)); e_36.Stroke = e_36_Stroke; e_36.StrokeThickness = 5F; e_36.RadiusX = 10F; e_36.RadiusY = 10F; Grid.SetColumn(e_36, 2); // e_37 element Ellipse e_37 = new Ellipse(); e_33.Children.Add(e_37); e_37.Name = "e_37"; e_37.Height = 100F; e_37.Width = 200F; e_37.Margin = new Thickness(5F, 5F, 5F, 5F); e_37.Fill = new SolidColorBrush(new ColorW(128, 128, 128, 255)); e_37.Stroke = new SolidColorBrush(new ColorW(0, 128, 0, 255)); e_37.StrokeThickness = 10F; Grid.SetRow(e_37, 1); // e_38 element Ellipse e_38 = new Ellipse(); e_33.Children.Add(e_38); e_38.Name = "e_38"; e_38.Height = 100F; e_38.Width = 200F; e_38.Margin = new Thickness(5F, 5F, 5F, 5F); e_38.Stroke = new SolidColorBrush(new ColorW(255, 165, 0, 255)); e_38.StrokeThickness = 10F; Grid.SetColumn(e_38, 1); Grid.SetRow(e_38, 1); // e_39 element Ellipse e_39 = new Ellipse(); e_33.Children.Add(e_39); e_39.Name = "e_39"; e_39.Height = 100F; e_39.Width = 200F; e_39.Margin = new Thickness(5F, 5F, 5F, 5F); LinearGradientBrush e_39_Fill = new LinearGradientBrush(); e_39_Fill.StartPoint = new PointF(0F, 0F); e_39_Fill.EndPoint = new PointF(1F, 1F); e_39_Fill.SpreadMethod = GradientSpreadMethod.Pad; e_39_Fill.GradientStops.Add(new GradientStop(new ColorW(255, 165, 0, 255), 0.5F)); e_39_Fill.GradientStops.Add(new GradientStop(new ColorW(0, 162, 255, 255), 0F)); e_39.Fill = e_39_Fill; LinearGradientBrush e_39_Stroke = new LinearGradientBrush(); e_39_Stroke.StartPoint = new PointF(0F, 0F); e_39_Stroke.EndPoint = new PointF(1F, 1F); e_39_Stroke.SpreadMethod = GradientSpreadMethod.Pad; e_39_Stroke.GradientStops.Add(new GradientStop(new ColorW(0, 162, 255, 255), 0.5F)); e_39_Stroke.GradientStops.Add(new GradientStop(new ColorW(255, 165, 0, 255), 0F)); e_39.Stroke = e_39_Stroke; e_39.StrokeThickness = 10F; Grid.SetColumn(e_39, 2); Grid.SetRow(e_39, 1); // e_40 element Line e_40 = new Line(); e_33.Children.Add(e_40); e_40.Name = "e_40"; e_40.Stroke = new SolidColorBrush(new ColorW(128, 128, 128, 255)); e_40.StrokeThickness = 10F; e_40.X1 = 10F; e_40.X2 = 150F; e_40.Y1 = 10F; e_40.Y2 = 150F; Grid.SetRow(e_40, 2); // e_41 element Line e_41 = new Line(); e_33.Children.Add(e_41); e_41.Name = "e_41"; e_41.Stroke = new SolidColorBrush(new ColorW(128, 128, 128, 255)); e_41.StrokeThickness = 10F; e_41.X1 = 100F; e_41.X2 = 100F; e_41.Y1 = 10F; e_41.Y2 = 100F; Grid.SetRow(e_41, 2); // e_42 element Line e_42 = new Line(); e_33.Children.Add(e_42); e_42.Name = "e_42"; e_42.Stroke = new SolidColorBrush(new ColorW(128, 128, 128, 255)); e_42.StrokeThickness = 10F; e_42.X1 = 10F; e_42.X2 = 100F; e_42.Y1 = 100F; e_42.Y2 = 100F; Grid.SetRow(e_42, 2); // e_43 element Rectangle e_43 = new Rectangle(); e_33.Children.Add(e_43); e_43.Name = "e_43"; e_43.Height = 100F; e_43.Width = 200F; e_43.Margin = new Thickness(5F, 5F, 5F, 5F); ImageBrush e_43_Fill = new ImageBrush(); BitmapImage e_43_Fill_bm = new BitmapImage(); e_43_Fill_bm.TextureAsset = "Images/MonoGameLogo"; e_43_Fill.ImageSource = e_43_Fill_bm; e_43_Fill.Stretch = Stretch.None; e_43.Fill = e_43_Fill; e_43.Stroke = new SolidColorBrush(new ColorW(255, 255, 255, 255)); e_43.StrokeThickness = 1F; e_43.RadiusX = 10F; e_43.RadiusY = 10F; Grid.SetColumn(e_43, 1); Grid.SetRow(e_43, 2); items.Add(e_32); // e_44 element TabItem e_44 = new TabItem(); e_44.Name = "e_44"; e_44.Header = "Animations"; // e_45 element Grid e_45 = new Grid(); e_44.Content = e_45; e_45.Name = "e_45"; ColumnDefinition col_e_45_0 = new ColumnDefinition(); e_45.ColumnDefinitions.Add(col_e_45_0); ColumnDefinition col_e_45_1 = new ColumnDefinition(); e_45.ColumnDefinitions.Add(col_e_45_1); // e_46 element StackPanel e_46 = new StackPanel(); e_45.Children.Add(e_46); e_46.Name = "e_46"; // animButton1 element Button animButton1 = new Button(); e_46.Children.Add(animButton1); animButton1.Name = "animButton1"; animButton1.TabIndex = 1; animButton1.Content = "Mouse Over me!"; animButton1.SetResourceReference(Button.StyleProperty, "buttonAnimStyle"); // animButton2 element Button animButton2 = new Button(); e_46.Children.Add(animButton2); animButton2.Name = "animButton2"; animButton2.TabIndex = 2; animButton2.Content = "Mouse Over me!"; animButton2.SetResourceReference(Button.StyleProperty, "buttonAnimStyle"); // animButton3 element Button animButton3 = new Button(); e_46.Children.Add(animButton3); animButton3.Name = "animButton3"; animButton3.TabIndex = 3; animButton3.Content = "Mouse Over me!"; animButton3.SetResourceReference(Button.StyleProperty, "buttonAnimStyle"); // animButton4 element Button animButton4 = new Button(); e_46.Children.Add(animButton4); animButton4.Name = "animButton4"; animButton4.TabIndex = 4; animButton4.Content = "Mouse Over me!"; animButton4.SetResourceReference(Button.StyleProperty, "buttonAnimStyle"); // animBorder1 element Border animBorder1 = new Border(); e_45.Children.Add(animBorder1); animBorder1.Name = "animBorder1"; animBorder1.Height = 100F; animBorder1.Width = 200F; animBorder1.Margin = new Thickness(0F, 10F, 0F, 10F); animBorder1.VerticalAlignment = VerticalAlignment.Top; EventTrigger animBorder1_ET_0 = new EventTrigger(Border.LoadedEvent, animBorder1); animBorder1.Triggers.Add(animBorder1_ET_0); BeginStoryboard animBorder1_ET_0_AC_0 = new BeginStoryboard(); animBorder1_ET_0_AC_0.Name = "animBorder1_ET_0_AC_0"; animBorder1_ET_0.AddAction(animBorder1_ET_0_AC_0); Storyboard animBorder1_ET_0_AC_0_SB = new Storyboard(); animBorder1_ET_0_AC_0.Storyboard = animBorder1_ET_0_AC_0_SB; animBorder1_ET_0_AC_0_SB.Name = "animBorder1_ET_0_AC_0_SB"; SolidColorBrushAnimation animBorder1_ET_0_AC_0_SB_TL_0 = new SolidColorBrushAnimation(); animBorder1_ET_0_AC_0_SB_TL_0.Name = "animBorder1_ET_0_AC_0_SB_TL_0"; animBorder1_ET_0_AC_0_SB_TL_0.AutoReverse = true; animBorder1_ET_0_AC_0_SB_TL_0.Duration = new Duration(new TimeSpan(0, 0, 0, 5, 0)); animBorder1_ET_0_AC_0_SB_TL_0.RepeatBehavior = RepeatBehavior.Forever; animBorder1_ET_0_AC_0_SB_TL_0.From = new ColorW(255, 255, 0, 255); animBorder1_ET_0_AC_0_SB_TL_0.To = new ColorW(0, 0, 255, 255); ExponentialEase animBorder1_ET_0_AC_0_SB_TL_0_EA = new ExponentialEase(); animBorder1_ET_0_AC_0_SB_TL_0.EasingFunction = animBorder1_ET_0_AC_0_SB_TL_0_EA; Storyboard.SetTargetName(animBorder1_ET_0_AC_0_SB_TL_0, "animBorder1"); Storyboard.SetTargetProperty(animBorder1_ET_0_AC_0_SB_TL_0, Border.BackgroundProperty); animBorder1_ET_0_AC_0_SB.Children.Add(animBorder1_ET_0_AC_0_SB_TL_0); Grid.SetColumn(animBorder1, 1); // animBorder2 element Border animBorder2 = new Border(); e_45.Children.Add(animBorder2); animBorder2.Name = "animBorder2"; animBorder2.Height = 50F; animBorder2.Width = 100F; animBorder2.Margin = new Thickness(50F, 35F, 50F, 35F); animBorder2.VerticalAlignment = VerticalAlignment.Top; EventTrigger animBorder2_ET_0 = new EventTrigger(Border.LoadedEvent, animBorder2); animBorder2.Triggers.Add(animBorder2_ET_0); BeginStoryboard animBorder2_ET_0_AC_0 = new BeginStoryboard(); animBorder2_ET_0_AC_0.Name = "animBorder2_ET_0_AC_0"; animBorder2_ET_0.AddAction(animBorder2_ET_0_AC_0); Storyboard animBorder2_ET_0_AC_0_SB = new Storyboard(); animBorder2_ET_0_AC_0.Storyboard = animBorder2_ET_0_AC_0_SB; animBorder2_ET_0_AC_0_SB.Name = "animBorder2_ET_0_AC_0_SB"; SolidColorBrushAnimation animBorder2_ET_0_AC_0_SB_TL_0 = new SolidColorBrushAnimation(); animBorder2_ET_0_AC_0_SB_TL_0.Name = "animBorder2_ET_0_AC_0_SB_TL_0"; animBorder2_ET_0_AC_0_SB_TL_0.AutoReverse = true; animBorder2_ET_0_AC_0_SB_TL_0.Duration = new Duration(new TimeSpan(0, 0, 0, 3, 0)); animBorder2_ET_0_AC_0_SB_TL_0.RepeatBehavior = RepeatBehavior.Forever; animBorder2_ET_0_AC_0_SB_TL_0.From = new ColorW(255, 0, 0, 255); animBorder2_ET_0_AC_0_SB_TL_0.To = new ColorW(255, 255, 255, 255); CubicEase animBorder2_ET_0_AC_0_SB_TL_0_EA = new CubicEase(); animBorder2_ET_0_AC_0_SB_TL_0.EasingFunction = animBorder2_ET_0_AC_0_SB_TL_0_EA; Storyboard.SetTargetName(animBorder2_ET_0_AC_0_SB_TL_0, "animBorder2"); Storyboard.SetTargetProperty(animBorder2_ET_0_AC_0_SB_TL_0, Border.BackgroundProperty); animBorder2_ET_0_AC_0_SB.Children.Add(animBorder2_ET_0_AC_0_SB_TL_0); FloatAnimation animBorder2_ET_0_AC_0_SB_TL_1 = new FloatAnimation(); animBorder2_ET_0_AC_0_SB_TL_1.Name = "animBorder2_ET_0_AC_0_SB_TL_1"; animBorder2_ET_0_AC_0_SB_TL_1.AutoReverse = true; animBorder2_ET_0_AC_0_SB_TL_1.Duration = new Duration(new TimeSpan(0, 0, 0, 4, 0)); animBorder2_ET_0_AC_0_SB_TL_1.RepeatBehavior = RepeatBehavior.Forever; animBorder2_ET_0_AC_0_SB_TL_1.From = 1F; animBorder2_ET_0_AC_0_SB_TL_1.To = 0F; Storyboard.SetTargetName(animBorder2_ET_0_AC_0_SB_TL_1, "animBorder2"); Storyboard.SetTargetProperty(animBorder2_ET_0_AC_0_SB_TL_1, Border.OpacityProperty); animBorder2_ET_0_AC_0_SB.Children.Add(animBorder2_ET_0_AC_0_SB_TL_1); Grid.SetColumn(animBorder2, 1); items.Add(e_44); // e_47 element TabItem e_47 = new TabItem(); e_47.Name = "e_47"; e_47.Header = "Tetris"; // e_48 element Border e_48 = new Border(); e_47.Content = e_48; e_48.Name = "e_48"; // e_49 element Grid e_49 = new Grid(); e_48.Child = e_49; e_49.Name = "e_49"; e_49.Margin = new Thickness(10F, 10F, 10F, 10F); RowDefinition row_e_49_0 = new RowDefinition(); row_e_49_0.Height = new GridLength(1F, GridUnitType.Auto); e_49.RowDefinitions.Add(row_e_49_0); RowDefinition row_e_49_1 = new RowDefinition(); row_e_49_1.Height = new GridLength(420F, GridUnitType.Pixel); e_49.RowDefinitions.Add(row_e_49_1); ColumnDefinition col_e_49_0 = new ColumnDefinition(); e_49.ColumnDefinitions.Add(col_e_49_0); ColumnDefinition col_e_49_1 = new ColumnDefinition(); e_49.ColumnDefinitions.Add(col_e_49_1); ColumnDefinition col_e_49_2 = new ColumnDefinition(); e_49.ColumnDefinitions.Add(col_e_49_2); // e_50 element StackPanel e_50 = new StackPanel(); e_49.Children.Add(e_50); e_50.Name = "e_50"; e_50.HorizontalAlignment = HorizontalAlignment.Right; e_50.Orientation = Orientation.Vertical; Grid.SetRow(e_50, 1); // e_51 element TextBlock e_51 = new TextBlock(); e_50.Children.Add(e_51); e_51.Name = "e_51"; e_51.Text = "Next"; // e_52 element Border e_52 = new Border(); e_50.Children.Add(e_52); e_52.Name = "e_52"; e_52.Height = 81F; e_52.Width = 81F; e_52.BorderBrush = new SolidColorBrush(new ColorW(255, 255, 255, 255)); e_52.BorderThickness = new Thickness(0F, 0F, 1F, 1F); // tetrisNextContainer1 element Canvas tetrisNextContainer1 = new Canvas(); e_52.Child = tetrisNextContainer1; tetrisNextContainer1.Name = "tetrisNextContainer1"; tetrisNextContainer1.Height = 80F; tetrisNextContainer1.Width = 80F; // e_53 element Border e_53 = new Border(); e_49.Children.Add(e_53); e_53.Name = "e_53"; e_53.Height = 401F; e_53.Width = 201F; e_53.BorderBrush = new SolidColorBrush(new ColorW(255, 255, 255, 255)); e_53.BorderThickness = new Thickness(0F, 0F, 1F, 1F); Grid.SetColumn(e_53, 1); Grid.SetRow(e_53, 1); // tetrisContainer1 element Canvas tetrisContainer1 = new Canvas(); e_53.Child = tetrisContainer1; tetrisContainer1.Name = "tetrisContainer1"; tetrisContainer1.Height = 400F; tetrisContainer1.Width = 200F; tetrisContainer1.HorizontalAlignment = HorizontalAlignment.Left; tetrisContainer1.VerticalAlignment = VerticalAlignment.Top; // e_54 element Grid e_54 = new Grid(); e_49.Children.Add(e_54); e_54.Name = "e_54"; RowDefinition row_e_54_0 = new RowDefinition(); row_e_54_0.Height = new GridLength(1F, GridUnitType.Auto); e_54.RowDefinitions.Add(row_e_54_0); RowDefinition row_e_54_1 = new RowDefinition(); row_e_54_1.Height = new GridLength(1F, GridUnitType.Auto); e_54.RowDefinitions.Add(row_e_54_1); ColumnDefinition col_e_54_0 = new ColumnDefinition(); col_e_54_0.Width = new GridLength(1F, GridUnitType.Auto); e_54.ColumnDefinitions.Add(col_e_54_0); ColumnDefinition col_e_54_1 = new ColumnDefinition(); col_e_54_1.Width = new GridLength(1F, GridUnitType.Star); e_54.ColumnDefinitions.Add(col_e_54_1); ColumnDefinition col_e_54_2 = new ColumnDefinition(); col_e_54_2.Width = new GridLength(1F, GridUnitType.Auto); e_54.ColumnDefinitions.Add(col_e_54_2); Grid.SetColumnSpan(e_54, 3); Binding binding_e_54_DataContext = new Binding("Tetris"); e_54.SetBinding(Grid.DataContextProperty, binding_e_54_DataContext); // e_55 element Button e_55 = new Button(); e_54.Children.Add(e_55); e_55.Name = "e_55"; e_55.Height = 30F; e_55.Content = "Start"; Grid.SetColumnSpan(e_55, 3); Binding binding_e_55_Command = new Binding("StartCommand"); e_55.SetBinding(Button.CommandProperty, binding_e_55_Command); // e_56 element Grid e_56 = new Grid(); e_54.Children.Add(e_56); e_56.Name = "e_56"; RowDefinition row_e_56_0 = new RowDefinition(); row_e_56_0.Height = new GridLength(1F, GridUnitType.Auto); e_56.RowDefinitions.Add(row_e_56_0); ColumnDefinition col_e_56_0 = new ColumnDefinition(); e_56.ColumnDefinitions.Add(col_e_56_0); ColumnDefinition col_e_56_1 = new ColumnDefinition(); col_e_56_1.Width = new GridLength(70F, GridUnitType.Pixel); e_56.ColumnDefinitions.Add(col_e_56_1); ColumnDefinition col_e_56_2 = new ColumnDefinition(); e_56.ColumnDefinitions.Add(col_e_56_2); Grid.SetColumn(e_56, 1); Grid.SetRow(e_56, 1); // spPlayer1 element StackPanel spPlayer1 = new StackPanel(); e_56.Children.Add(spPlayer1); spPlayer1.Name = "spPlayer1"; spPlayer1.HorizontalAlignment = HorizontalAlignment.Right; spPlayer1.Orientation = Orientation.Vertical; // e_57 element TextBlock e_57 = new TextBlock(); spPlayer1.Children.Add(e_57); e_57.Name = "e_57"; Binding binding_e_57_Text = new Binding("Score"); e_57.SetBinding(TextBlock.TextProperty, binding_e_57_Text); // e_58 element TextBlock e_58 = new TextBlock(); spPlayer1.Children.Add(e_58); e_58.Name = "e_58"; Binding binding_e_58_Text = new Binding("Lines"); e_58.SetBinding(TextBlock.TextProperty, binding_e_58_Text); // e_59 element TextBlock e_59 = new TextBlock(); spPlayer1.Children.Add(e_59); e_59.Name = "e_59"; Binding binding_e_59_Text = new Binding("Level"); e_59.SetBinding(TextBlock.TextProperty, binding_e_59_Text); // e_60 element StackPanel e_60 = new StackPanel(); e_56.Children.Add(e_60); e_60.Name = "e_60"; e_60.HorizontalAlignment = HorizontalAlignment.Center; e_60.Orientation = Orientation.Vertical; Grid.SetColumn(e_60, 1); // e_61 element TextBlock e_61 = new TextBlock(); e_60.Children.Add(e_61); e_61.Name = "e_61"; e_61.Text = "SCORE"; // e_62 element TextBlock e_62 = new TextBlock(); e_60.Children.Add(e_62); e_62.Name = "e_62"; e_62.Text = "LINES"; // e_63 element TextBlock e_63 = new TextBlock(); e_60.Children.Add(e_63); e_63.Name = "e_63"; e_63.Text = "LEVEL"; // e_64 element StackPanel e_64 = new StackPanel(); e_56.Children.Add(e_64); e_64.Name = "e_64"; e_64.HorizontalAlignment = HorizontalAlignment.Left; e_64.Orientation = Orientation.Horizontal; // e_65 element TextBlock e_65 = new TextBlock(); e_64.Children.Add(e_65); e_65.Name = "e_65"; e_65.Text = "Use A,S,D,W for left, down, right, rotate"; items.Add(e_47); return items; }
public AutoReverseExample() { // Create a name scope for the page. NameScope.SetNameScope(this, new NameScope()); StackPanel myStackPanel = new StackPanel(); myStackPanel.Margin = new Thickness(20); Border myBorder = new Border(); TextBlock myTextBlock = new TextBlock(); myTextBlock.Margin = new Thickness(20); myTextBlock.Text = "This example shows how to use the AutoReverse property to make a"; myTextBlock.Text += " timeline play backwards at the end of each iteration. Several rectangles are"; myTextBlock.Text += " animated by DoubleAnimations with identical durations and target values, but with different "; myTextBlock.Text += " AutoReverse and RepeatBehavior settings."; myBorder.Child = myTextBlock; myStackPanel.Children.Add(myBorder); myTextBlock = new TextBlock(); myTextBlock.Text = "AutoReverse=\"False\" (Default)."; myStackPanel.Children.Add(myTextBlock); // // Create the rectangles to animate // Rectangle withoutAutoReverseRectangle = new Rectangle(); withoutAutoReverseRectangle.Name = "withoutAutoReverseRectangle"; this.RegisterName(withoutAutoReverseRectangle.Name, withoutAutoReverseRectangle); withoutAutoReverseRectangle.Width = 100; withoutAutoReverseRectangle.Height = 20; SolidColorBrush mySolidColorBrush = new SolidColorBrush(Color.FromArgb(170, 51, 51, 255)); withoutAutoReverseRectangle.Fill = mySolidColorBrush; withoutAutoReverseRectangle.HorizontalAlignment = HorizontalAlignment.Left; myStackPanel.Children.Add(withoutAutoReverseRectangle); myTextBlock = new TextBlock(); myTextBlock.Margin = new Thickness(0, 20, 0, 0); myTextBlock.Text = "AutoReverse=\"True\"."; myStackPanel.Children.Add(myTextBlock); Rectangle autoReverseRectangle = new Rectangle(); autoReverseRectangle.Name = "autoReverseRectangle"; this.RegisterName(autoReverseRectangle.Name, autoReverseRectangle); autoReverseRectangle.Width = 100; autoReverseRectangle.Height = 20; autoReverseRectangle.Fill = mySolidColorBrush; autoReverseRectangle.HorizontalAlignment = HorizontalAlignment.Left; myStackPanel.Children.Add(autoReverseRectangle); myTextBlock = new TextBlock(); myTextBlock.Margin = new Thickness(0, 20, 0, 0); myTextBlock.Text = "In this example, AutoReverse=\"True\" \nRepeatBehavior=\"2x\"."; myStackPanel.Children.Add(myTextBlock); Rectangle autoReverseRectangleWithRepeats = new Rectangle(); autoReverseRectangleWithRepeats.Name = "autoReverseRectangleWithRepeats"; this.RegisterName(autoReverseRectangleWithRepeats.Name, autoReverseRectangleWithRepeats); autoReverseRectangleWithRepeats.Width = 100; autoReverseRectangleWithRepeats.Height = 20; autoReverseRectangleWithRepeats.Fill = mySolidColorBrush; autoReverseRectangleWithRepeats.HorizontalAlignment = HorizontalAlignment.Left; myStackPanel.Children.Add(autoReverseRectangleWithRepeats); myTextBlock = new TextBlock(); myTextBlock.Margin = new Thickness(0, 20, 0, 0); myTextBlock.Text = "In this example, AutoReverse=\"True\" and RepeatBehavior=\"2x\" "; myTextBlock.Text += "have been set on the animation's parent timeline."; myStackPanel.Children.Add(myTextBlock); Rectangle complexAutoReverseExample = new Rectangle(); complexAutoReverseExample.Name = "complexAutoReverseExample"; this.RegisterName(complexAutoReverseExample.Name, complexAutoReverseExample); complexAutoReverseExample.Width = 100; complexAutoReverseExample.Height = 20; complexAutoReverseExample.Fill = mySolidColorBrush; complexAutoReverseExample.HorizontalAlignment = HorizontalAlignment.Left; myStackPanel.Children.Add(complexAutoReverseExample); // // Create an animation that does not automatically play in reverse. // DoubleAnimation myDoubleAnimation = new DoubleAnimation(); Storyboard.SetTargetName(myDoubleAnimation, withoutAutoReverseRectangle.Name); Storyboard.SetTargetProperty(myDoubleAnimation, new PropertyPath(Rectangle.WidthProperty)); myDoubleAnimation.From = 100; myDoubleAnimation.To = 400; myDoubleAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(2000)); myDoubleAnimation.AutoReverse = false; // // Create an animation that automatically reverses at the end of each iteration. // DoubleAnimation myAutomaticallyReversedDoubleAnimation = new DoubleAnimation(); Storyboard.SetTargetName(myAutomaticallyReversedDoubleAnimation, autoReverseRectangle.Name); Storyboard.SetTargetProperty(myAutomaticallyReversedDoubleAnimation, new PropertyPath(Rectangle.WidthProperty)); myAutomaticallyReversedDoubleAnimation.From = 100; myAutomaticallyReversedDoubleAnimation.To = 400; myAutomaticallyReversedDoubleAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(2000)); myAutomaticallyReversedDoubleAnimation.AutoReverse = true; // // Create an animation that automatically reverses at the end of each iteration. // Set the animation to repeat twice. As // a result, then animation plays forward, then backward, then forward, and then backward again. DoubleAnimation myRepeatedAndReversedDoubleAnimation = new DoubleAnimation(); Storyboard.SetTargetName(myRepeatedAndReversedDoubleAnimation, autoReverseRectangleWithRepeats.Name); Storyboard.SetTargetProperty(myRepeatedAndReversedDoubleAnimation, new PropertyPath(Rectangle.WidthProperty)); myRepeatedAndReversedDoubleAnimation.From = 100; myRepeatedAndReversedDoubleAnimation.To = 400; myRepeatedAndReversedDoubleAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(2000)); myRepeatedAndReversedDoubleAnimation.AutoReverse = true; myRepeatedAndReversedDoubleAnimation.RepeatBehavior = new RepeatBehavior(2); // // Set the parent timeline's AutoReverse property to True and set the animation's // RepeatBehavior to 2x. As a result, the animation plays forward twice and then backwards twice. // ParallelTimeline myParallelTimeline = new ParallelTimeline(); myParallelTimeline.AutoReverse = true; DoubleAnimation myParallelRepeatedAndReversedDoubleAnimation = new DoubleAnimation(); Storyboard.SetTargetName(myParallelRepeatedAndReversedDoubleAnimation, complexAutoReverseExample.Name); Storyboard.SetTargetProperty(myParallelRepeatedAndReversedDoubleAnimation, new PropertyPath(Rectangle.WidthProperty)); myParallelRepeatedAndReversedDoubleAnimation.From = 100; myParallelRepeatedAndReversedDoubleAnimation.To = 400; myParallelRepeatedAndReversedDoubleAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(2000)); myParallelRepeatedAndReversedDoubleAnimation.AutoReverse = true; myParallelRepeatedAndReversedDoubleAnimation.RepeatBehavior = new RepeatBehavior(2); // // Create a Storyboard to contain the animations and add the animations to the Storyboard // Storyboard myStoryboard = new Storyboard(); myStoryboard.Children.Add(myDoubleAnimation); myStoryboard.Children.Add(myAutomaticallyReversedDoubleAnimation); myStoryboard.Children.Add(myRepeatedAndReversedDoubleAnimation); myParallelTimeline.Children.Add(myParallelRepeatedAndReversedDoubleAnimation); myStoryboard.Children.Add(myParallelTimeline); // // Create the button to restart the animations. // Button myButton = new Button(); myButton.Margin = new Thickness(0, 30, 0, 0); myButton.HorizontalAlignment = HorizontalAlignment.Left; myButton.Content = "Restart Animations"; myStackPanel.Children.Add(myButton); // // Create an EventTrigger and a BeginStoryboard action to start // the storyboard BeginStoryboard myBeginStoryboard = new BeginStoryboard(); myBeginStoryboard.Storyboard = myStoryboard; EventTrigger myEventTrigger = new EventTrigger(); myEventTrigger.RoutedEvent = Button.ClickEvent; myEventTrigger.SourceName = myButton.Name; myEventTrigger.Actions.Add(myBeginStoryboard); myStackPanel.Triggers.Add(myEventTrigger); this.Content = myStackPanel; }
private void InitializeComponent() { this.FontSize = 13.33333F; this.SetResourceReference(SoundManager.SoundsProperty, "Sounds"); InitializeElementResources(this); // e_0 element this.e_0 = new Grid(); this.Content = this.e_0; this.e_0.Name = "e_0"; RowDefinition row_e_0_0 = new RowDefinition(); row_e_0_0.Height = new GridLength(110F, GridUnitType.Pixel); this.e_0.RowDefinitions.Add(row_e_0_0); RowDefinition row_e_0_1 = new RowDefinition(); this.e_0.RowDefinitions.Add(row_e_0_1); ColumnDefinition col_e_0_0 = new ColumnDefinition(); this.e_0.ColumnDefinitions.Add(col_e_0_0); ColumnDefinition col_e_0_1 = new ColumnDefinition(); this.e_0.ColumnDefinitions.Add(col_e_0_1); // e_1 element this.e_1 = new StackPanel(); this.e_0.Children.Add(this.e_1); this.e_1.Name = "e_1"; this.e_1.Background = new SolidColorBrush(new ColorW(0, 0, 0, 255)); Grid.SetColumnSpan(this.e_1, 2); // logo element this.logo = new Image(); this.e_1.Children.Add(this.logo); this.logo.Name = "logo"; this.logo.HorizontalAlignment = HorizontalAlignment.Center; BitmapImage logo_bm = new BitmapImage(); logo_bm.TextureAsset = "Images/EmptyKeysLogoTextSmall"; this.logo.Source = logo_bm; this.logo.Stretch = Stretch.None; this.logo.SetResourceReference(Image.SourceProperty, "logoEmptyKeys"); // e_2 element this.e_2 = new TextBlock(); this.e_1.Children.Add(this.e_2); this.e_2.Name = "e_2"; this.e_2.HorizontalAlignment = HorizontalAlignment.Center; this.e_2.VerticalAlignment = VerticalAlignment.Center; this.e_2.Foreground = new SolidColorBrush(new ColorW(211, 211, 211, 255)); this.e_2.TextWrapping = TextWrapping.Wrap; this.e_2.FontFamily = new FontFamily("Segoe UI"); this.e_2.FontSize = 20F; this.e_2.FontStyle = FontStyle.Bold; this.e_2.SetResourceReference(TextBlock.TextProperty, "TitleResource"); // e_3 element this.e_3 = new StackPanel(); this.e_0.Children.Add(this.e_3); this.e_3.Name = "e_3"; Grid.SetRow(this.e_3, 1); // combo element this.combo = new ComboBox(); this.e_3.Children.Add(this.combo); this.combo.Name = "combo"; this.combo.Width = 200F; this.combo.Margin = new Thickness(5F, 5F, 5F, 5F); Func<UIElement, UIElement> combo_dtFunc = combo_dtMethod; this.combo.ItemTemplate = new DataTemplate(combo_dtFunc); Binding binding_combo_ItemsSource = new Binding("ComboBoxSource"); this.combo.SetBinding(ComboBox.ItemsSourceProperty, binding_combo_ItemsSource); Binding binding_combo_SelectedIndex = new Binding("SelectedIndex"); this.combo.SetBinding(ComboBox.SelectedIndexProperty, binding_combo_SelectedIndex); // button1 element this.button1 = new Button(); this.e_3.Children.Add(this.button1); this.button1.Name = "button1"; this.button1.Height = 30F; this.button1.Width = 200F; this.button1.Margin = new Thickness(5F, 5F, 5F, 5F); ToolTip tt_button1 = new ToolTip(); this.button1.ToolTip = tt_button1; tt_button1.Content = "Click Me!"; this.button1.Content = "1"; this.button1.CommandParameter = "Click Button 1"; Binding binding_button1_Command = new Binding("ButtonCommand"); this.button1.SetBinding(Button.CommandProperty, binding_button1_Command); // button2 element this.button2 = new Button(); this.e_3.Children.Add(this.button2); this.button2.Name = "button2"; this.button2.Height = 30F; this.button2.Margin = new Thickness(5F, 5F, 5F, 5F); this.button2.Content = "2"; this.button2.CommandParameter = "Click Button 2"; Binding binding_button2_Command = new Binding("ButtonCommand"); this.button2.SetBinding(Button.CommandProperty, binding_button2_Command); this.button2.SetResourceReference(Button.StyleProperty, "buttonStyle"); // button3 element this.button3 = new Button(); this.e_3.Children.Add(this.button3); this.button3.Name = "button3"; this.button3.Height = 30F; this.button3.Width = 200F; this.button3.Margin = new Thickness(5F, 5F, 5F, 5F); this.button3.FontFamily = new FontFamily("Segoe UI"); this.button3.FontSize = 20F; this.button3.FontStyle = FontStyle.Bold; this.button3.Content = "3"; this.button3.CommandParameter = "Click Button 3"; Binding binding_button3_Command = new Binding("OpenMessageBox"); this.button3.SetBinding(Button.CommandProperty, binding_button3_Command); this.button3.SetResourceReference(Button.ToolTipProperty, "ToolTipText"); // buttonResult element this.buttonResult = new TextBlock(); this.e_3.Children.Add(this.buttonResult); this.buttonResult.Name = "buttonResult"; this.buttonResult.HorizontalAlignment = HorizontalAlignment.Center; Binding binding_buttonResult_Text = new Binding("ButtonResult"); this.buttonResult.SetBinding(TextBlock.TextProperty, binding_buttonResult_Text); // slider element this.slider = new Slider(); this.e_3.Children.Add(this.slider); this.slider.Name = "slider"; this.slider.Width = 200F; this.slider.Minimum = 5F; this.slider.Maximum = 20F; Binding binding_slider_Value = new Binding("SliderValue"); this.slider.SetBinding(Slider.ValueProperty, binding_slider_Value); // textBox element this.textBox = new TextBox(); this.e_3.Children.Add(this.textBox); this.textBox.Name = "textBox"; this.textBox.Width = 200F; this.textBox.Margin = new Thickness(5F, 5F, 5F, 5F); Binding binding_textBox_Text = new Binding("TextBoxText"); this.textBox.SetBinding(TextBox.TextProperty, binding_textBox_Text); // checkBox element this.checkBox = new CheckBox(); this.e_3.Children.Add(this.checkBox); this.checkBox.Name = "checkBox"; this.checkBox.Margin = new Thickness(5F, 5F, 5F, 5F); this.checkBox.HorizontalAlignment = HorizontalAlignment.Center; this.checkBox.Content = "Check Box"; // e_5 element this.e_5 = new TabControl(); this.e_3.Children.Add(this.e_5); this.e_5.Name = "e_5"; this.e_5.Height = 150F; this.e_5.Width = 400F; this.e_5.ItemsSource = Get_e_5_Items(); // e_18 element this.e_18 = new ProgressBar(); this.e_3.Children.Add(this.e_18); this.e_18.Name = "e_18"; this.e_18.Height = 30F; this.e_18.Width = 400F; this.e_18.Margin = new Thickness(5F, 5F, 5F, 5F); this.e_18.Value = 39F; // imageButton element this.imageButton = new Button(); this.e_3.Children.Add(this.imageButton); this.imageButton.Name = "imageButton"; this.imageButton.Height = 68F; this.imageButton.Width = 57F; ImageBrush imageButton_Background = new ImageBrush(); BitmapImage imageButton_Background_bm = new BitmapImage(); imageButton_Background_bm.TextureAsset = "Images/SunBurn"; imageButton_Background.ImageSource = imageButton_Background_bm; imageButton_Background.Stretch = Stretch.None; this.imageButton.Background = imageButton_Background; // e_19 element this.e_19 = new StackPanel(); this.e_0.Children.Add(this.e_19); this.e_19.Name = "e_19"; Grid.SetColumn(this.e_19, 1); Grid.SetRow(this.e_19, 1); // animButton1 element this.animButton1 = new Button(); this.e_19.Children.Add(this.animButton1); this.animButton1.Name = "animButton1"; this.animButton1.Content = "Mouse Over me!"; this.animButton1.SetResourceReference(Button.StyleProperty, "buttonAnimStyle"); // animButton2 element this.animButton2 = new Button(); this.e_19.Children.Add(this.animButton2); this.animButton2.Name = "animButton2"; this.animButton2.Content = "Mouse Over me!"; this.animButton2.SetResourceReference(Button.StyleProperty, "buttonAnimStyle"); // animButton3 element this.animButton3 = new Button(); this.e_19.Children.Add(this.animButton3); this.animButton3.Name = "animButton3"; this.animButton3.Content = "Mouse Over me!"; this.animButton3.SetResourceReference(Button.StyleProperty, "buttonAnimStyle"); // animButton4 element this.animButton4 = new Button(); this.e_19.Children.Add(this.animButton4); this.animButton4.Name = "animButton4"; this.animButton4.Content = "Mouse Over me!"; this.animButton4.SetResourceReference(Button.StyleProperty, "buttonAnimStyle"); // e_20 element this.e_20 = new Grid(); this.e_19.Children.Add(this.e_20); this.e_20.Name = "e_20"; // animBorder1 element this.animBorder1 = new Border(); this.e_20.Children.Add(this.animBorder1); this.animBorder1.Name = "animBorder1"; this.animBorder1.Height = 100F; this.animBorder1.Width = 200F; this.animBorder1.Margin = new Thickness(0F, 10F, 0F, 10F); EventTrigger animBorder1_ET_0 = new EventTrigger(Border.LoadedEvent, this.animBorder1); animBorder1.Triggers.Add(animBorder1_ET_0); BeginStoryboard animBorder1_ET_0_AC_0 = new BeginStoryboard(); animBorder1_ET_0_AC_0.Name = "animBorder1_ET_0_AC_0"; animBorder1_ET_0.AddAction(animBorder1_ET_0_AC_0); Storyboard animBorder1_ET_0_AC_0_SB = new Storyboard(); animBorder1_ET_0_AC_0.Storyboard = animBorder1_ET_0_AC_0_SB; animBorder1_ET_0_AC_0_SB.Name = "animBorder1_ET_0_AC_0_SB"; SolidColorBrushAnimation animBorder1_ET_0_AC_0_SB_TL_0 = new SolidColorBrushAnimation(); animBorder1_ET_0_AC_0_SB_TL_0.Name = "animBorder1_ET_0_AC_0_SB_TL_0"; animBorder1_ET_0_AC_0_SB_TL_0.AutoReverse = true; animBorder1_ET_0_AC_0_SB_TL_0.Duration = new Duration(new TimeSpan(0, 0, 0, 5, 0)); animBorder1_ET_0_AC_0_SB_TL_0.RepeatBehavior = RepeatBehavior.Forever; animBorder1_ET_0_AC_0_SB_TL_0.From = new ColorW(255, 255, 0, 255); animBorder1_ET_0_AC_0_SB_TL_0.To = new ColorW(0, 0, 255, 255); ExponentialEase animBorder1_ET_0_AC_0_SB_TL_0_EA = new ExponentialEase(); animBorder1_ET_0_AC_0_SB_TL_0.EasingFunction = animBorder1_ET_0_AC_0_SB_TL_0_EA; Storyboard.SetTargetName(animBorder1_ET_0_AC_0_SB_TL_0, "animBorder1"); Storyboard.SetTargetProperty(animBorder1_ET_0_AC_0_SB_TL_0, Border.BackgroundProperty); animBorder1_ET_0_AC_0_SB.Children.Add(animBorder1_ET_0_AC_0_SB_TL_0); // animBorder2 element this.animBorder2 = new Border(); this.e_20.Children.Add(this.animBorder2); this.animBorder2.Name = "animBorder2"; this.animBorder2.Height = 50F; this.animBorder2.Width = 100F; this.animBorder2.Margin = new Thickness(50F, 35F, 50F, 35F); EventTrigger animBorder2_ET_0 = new EventTrigger(Border.LoadedEvent, this.animBorder2); animBorder2.Triggers.Add(animBorder2_ET_0); BeginStoryboard animBorder2_ET_0_AC_0 = new BeginStoryboard(); animBorder2_ET_0_AC_0.Name = "animBorder2_ET_0_AC_0"; animBorder2_ET_0.AddAction(animBorder2_ET_0_AC_0); Storyboard animBorder2_ET_0_AC_0_SB = new Storyboard(); animBorder2_ET_0_AC_0.Storyboard = animBorder2_ET_0_AC_0_SB; animBorder2_ET_0_AC_0_SB.Name = "animBorder2_ET_0_AC_0_SB"; SolidColorBrushAnimation animBorder2_ET_0_AC_0_SB_TL_0 = new SolidColorBrushAnimation(); animBorder2_ET_0_AC_0_SB_TL_0.Name = "animBorder2_ET_0_AC_0_SB_TL_0"; animBorder2_ET_0_AC_0_SB_TL_0.AutoReverse = true; animBorder2_ET_0_AC_0_SB_TL_0.Duration = new Duration(new TimeSpan(0, 0, 0, 3, 0)); animBorder2_ET_0_AC_0_SB_TL_0.RepeatBehavior = RepeatBehavior.Forever; animBorder2_ET_0_AC_0_SB_TL_0.From = new ColorW(255, 0, 0, 255); animBorder2_ET_0_AC_0_SB_TL_0.To = new ColorW(255, 255, 255, 255); CubicEase animBorder2_ET_0_AC_0_SB_TL_0_EA = new CubicEase(); animBorder2_ET_0_AC_0_SB_TL_0.EasingFunction = animBorder2_ET_0_AC_0_SB_TL_0_EA; Storyboard.SetTargetName(animBorder2_ET_0_AC_0_SB_TL_0, "animBorder2"); Storyboard.SetTargetProperty(animBorder2_ET_0_AC_0_SB_TL_0, Border.BackgroundProperty); animBorder2_ET_0_AC_0_SB.Children.Add(animBorder2_ET_0_AC_0_SB_TL_0); FloatAnimation animBorder2_ET_0_AC_0_SB_TL_1 = new FloatAnimation(); animBorder2_ET_0_AC_0_SB_TL_1.Name = "animBorder2_ET_0_AC_0_SB_TL_1"; animBorder2_ET_0_AC_0_SB_TL_1.AutoReverse = true; animBorder2_ET_0_AC_0_SB_TL_1.Duration = new Duration(new TimeSpan(0, 0, 0, 4, 0)); animBorder2_ET_0_AC_0_SB_TL_1.RepeatBehavior = RepeatBehavior.Forever; animBorder2_ET_0_AC_0_SB_TL_1.From = 1F; animBorder2_ET_0_AC_0_SB_TL_1.To = 0F; Storyboard.SetTargetName(animBorder2_ET_0_AC_0_SB_TL_1, "animBorder2"); Storyboard.SetTargetProperty(animBorder2_ET_0_AC_0_SB_TL_1, Border.OpacityProperty); animBorder2_ET_0_AC_0_SB.Children.Add(animBorder2_ET_0_AC_0_SB_TL_1); ImageManager.Instance.AddImage("Images/EmptyKeysLogoTextSmall"); ImageManager.Instance.AddImage("Images/SunBurn"); FontManager.Instance.AddFont("Segoe UI", 13.33333F, FontStyle.Regular, "Segoe_UI_10_Regular"); FontManager.Instance.AddFont("Segoe UI", 20F, FontStyle.Bold, "Segoe_UI_15_Bold"); FontManager.Instance.AddFont("Segoe UI", 12F, FontStyle.Regular, "Segoe_UI_9_Regular"); }
private static System.Collections.ObjectModel.ObservableCollection<object> Get_TabControl_Items() { System.Collections.ObjectModel.ObservableCollection<object> items = new System.Collections.ObjectModel.ObservableCollection<object>(); // e_3 element TabItem e_3 = new TabItem(); e_3.Name = "e_3"; e_3.HorizontalContentAlignment = HorizontalAlignment.Stretch; e_3.Header = "Controls"; // e_4 element Grid e_4 = new Grid(); e_3.Content = e_4; e_4.Name = "e_4"; RowDefinition row_e_4_0 = new RowDefinition(); row_e_4_0.Height = new GridLength(1F, GridUnitType.Auto); e_4.RowDefinitions.Add(row_e_4_0); RowDefinition row_e_4_1 = new RowDefinition(); row_e_4_1.Height = new GridLength(1F, GridUnitType.Auto); e_4.RowDefinitions.Add(row_e_4_1); RowDefinition row_e_4_2 = new RowDefinition(); row_e_4_2.Height = new GridLength(1F, GridUnitType.Auto); e_4.RowDefinitions.Add(row_e_4_2); RowDefinition row_e_4_3 = new RowDefinition(); row_e_4_3.Height = new GridLength(1F, GridUnitType.Auto); e_4.RowDefinitions.Add(row_e_4_3); RowDefinition row_e_4_4 = new RowDefinition(); row_e_4_4.Height = new GridLength(1F, GridUnitType.Auto); e_4.RowDefinitions.Add(row_e_4_4); RowDefinition row_e_4_5 = new RowDefinition(); row_e_4_5.Height = new GridLength(1F, GridUnitType.Auto); e_4.RowDefinitions.Add(row_e_4_5); RowDefinition row_e_4_6 = new RowDefinition(); row_e_4_6.Height = new GridLength(1F, GridUnitType.Auto); e_4.RowDefinitions.Add(row_e_4_6); RowDefinition row_e_4_7 = new RowDefinition(); row_e_4_7.Height = new GridLength(1F, GridUnitType.Auto); e_4.RowDefinitions.Add(row_e_4_7); RowDefinition row_e_4_8 = new RowDefinition(); row_e_4_8.Height = new GridLength(1F, GridUnitType.Auto); e_4.RowDefinitions.Add(row_e_4_8); RowDefinition row_e_4_9 = new RowDefinition(); row_e_4_9.Height = new GridLength(1F, GridUnitType.Auto); e_4.RowDefinitions.Add(row_e_4_9); RowDefinition row_e_4_10 = new RowDefinition(); row_e_4_10.Height = new GridLength(1F, GridUnitType.Auto); e_4.RowDefinitions.Add(row_e_4_10); RowDefinition row_e_4_11 = new RowDefinition(); row_e_4_11.Height = new GridLength(1F, GridUnitType.Auto); e_4.RowDefinitions.Add(row_e_4_11); ColumnDefinition col_e_4_0 = new ColumnDefinition(); col_e_4_0.Width = new GridLength(1F, GridUnitType.Auto); e_4.ColumnDefinitions.Add(col_e_4_0); ColumnDefinition col_e_4_1 = new ColumnDefinition(); e_4.ColumnDefinitions.Add(col_e_4_1); // e_5 element TextBlock e_5 = new TextBlock(); e_4.Children.Add(e_5); e_5.Name = "e_5"; e_5.VerticalAlignment = VerticalAlignment.Center; e_5.Text = "Button"; // button1 element Button button1 = new Button(); e_4.Children.Add(button1); button1.Name = "button1"; button1.Height = 30F; button1.Width = 200F; button1.Margin = new Thickness(5F, 5F, 5F, 5F); button1.HorizontalAlignment = HorizontalAlignment.Left; button1.TabIndex = 1; button1.Content = "Button 1"; button1.CommandParameter = "Click Button 1"; Grid.SetColumn(button1, 1); Grid.SetRow(button1, 0); Binding binding_button1_Command = new Binding("ButtonCommand"); button1.SetBinding(Button.CommandProperty, binding_button1_Command); // button2 element Button button2 = new Button(); e_4.Children.Add(button2); button2.Name = "button2"; button2.Height = 30F; button2.Width = 200F; button2.Margin = new Thickness(5F, 5F, 5F, 5F); button2.HorizontalAlignment = HorizontalAlignment.Left; button2.TabIndex = 2; button2.Content = "Button 2"; button2.CommandParameter = "Click Button 2"; Grid.SetColumn(button2, 1); Grid.SetRow(button2, 1); Binding binding_button2_IsEnabled = new Binding("ButtonEnabled"); button2.SetBinding(Button.IsEnabledProperty, binding_button2_IsEnabled); Binding binding_button2_Command = new Binding("ButtonCommand"); button2.SetBinding(Button.CommandProperty, binding_button2_Command); // buttonResult element TextBlock buttonResult = new TextBlock(); e_4.Children.Add(buttonResult); buttonResult.Name = "buttonResult"; buttonResult.HorizontalAlignment = HorizontalAlignment.Left; Grid.SetColumn(buttonResult, 1); Grid.SetRow(buttonResult, 2); Binding binding_buttonResult_Text = new Binding("ButtonResult"); buttonResult.SetBinding(TextBlock.TextProperty, binding_buttonResult_Text); // e_6 element TextBlock e_6 = new TextBlock(); e_4.Children.Add(e_6); e_6.Name = "e_6"; e_6.VerticalAlignment = VerticalAlignment.Center; e_6.Text = "CheckBox"; Grid.SetRow(e_6, 3); // checkBox element CheckBox checkBox = new CheckBox(); e_4.Children.Add(checkBox); checkBox.Name = "checkBox"; checkBox.Margin = new Thickness(5F, 5F, 5F, 5F); checkBox.HorizontalAlignment = HorizontalAlignment.Left; checkBox.TabIndex = 3; checkBox.Content = "Check Box"; Grid.SetColumn(checkBox, 1); Grid.SetRow(checkBox, 3); // e_7 element TextBlock e_7 = new TextBlock(); e_4.Children.Add(e_7); e_7.Name = "e_7"; e_7.VerticalAlignment = VerticalAlignment.Center; e_7.Text = "ProgressBar"; Grid.SetRow(e_7, 4); // e_8 element ProgressBar e_8 = new ProgressBar(); e_4.Children.Add(e_8); e_8.Name = "e_8"; e_8.Height = 30F; e_8.Width = 200F; e_8.Margin = new Thickness(5F, 5F, 5F, 5F); e_8.HorizontalAlignment = HorizontalAlignment.Left; Grid.SetColumn(e_8, 1); Grid.SetRow(e_8, 4); Binding binding_e_8_Value = new Binding("ProgressValue"); e_8.SetBinding(ProgressBar.ValueProperty, binding_e_8_Value); // e_9 element TextBlock e_9 = new TextBlock(); e_4.Children.Add(e_9); e_9.Name = "e_9"; e_9.VerticalAlignment = VerticalAlignment.Center; e_9.Text = "Slider"; Grid.SetRow(e_9, 5); // slider element Slider slider = new Slider(); e_4.Children.Add(slider); slider.Name = "slider"; slider.Width = 200F; slider.HorizontalAlignment = HorizontalAlignment.Left; slider.TabIndex = 4; slider.Minimum = 5F; slider.Maximum = 20F; Grid.SetColumn(slider, 1); Grid.SetRow(slider, 5); Binding binding_slider_Value = new Binding("SliderValue"); slider.SetBinding(Slider.ValueProperty, binding_slider_Value); // e_10 element TextBlock e_10 = new TextBlock(); e_4.Children.Add(e_10); e_10.Name = "e_10"; e_10.VerticalAlignment = VerticalAlignment.Center; e_10.Text = "TextBox"; Grid.SetRow(e_10, 6); // textBox element TextBox textBox = new TextBox(); e_4.Children.Add(textBox); textBox.Name = "textBox"; textBox.Width = 200F; textBox.Margin = new Thickness(5F, 5F, 5F, 5F); textBox.HorizontalAlignment = HorizontalAlignment.Left; textBox.TabIndex = 5; textBox.SelectionBrush = new SolidColorBrush(new ColorW(255, 0, 0, 255)); textBox.UndoLimit = 20; Grid.SetColumn(textBox, 1); Grid.SetRow(textBox, 6); Binding binding_textBox_Text = new Binding("TextBoxText"); textBox.SetBinding(TextBox.TextProperty, binding_textBox_Text); // e_11 element TextBlock e_11 = new TextBlock(); e_4.Children.Add(e_11); e_11.Name = "e_11"; e_11.VerticalAlignment = VerticalAlignment.Center; e_11.Text = "Numeric"; Grid.SetRow(e_11, 7); // numTextBox element NumericTextBox numTextBox = new NumericTextBox(); e_4.Children.Add(numTextBox); numTextBox.Name = "numTextBox"; numTextBox.Width = 200F; numTextBox.Margin = new Thickness(5F, 5F, 5F, 5F); numTextBox.HorizontalAlignment = HorizontalAlignment.Left; numTextBox.TabIndex = 6; numTextBox.ValueFormat = "F0"; numTextBox.ValueStyle = ((System.Globalization.NumberStyles)(7)); Grid.SetColumn(numTextBox, 1); Grid.SetRow(numTextBox, 7); Binding binding_numTextBox_Value = new Binding("NumericTextBoxValue"); numTextBox.SetBinding(NumericTextBox.ValueProperty, binding_numTextBox_Value); // e_12 element TextBlock e_12 = new TextBlock(); e_4.Children.Add(e_12); e_12.Name = "e_12"; e_12.VerticalAlignment = VerticalAlignment.Center; e_12.Text = "PasswordBox"; Grid.SetRow(e_12, 8); // e_13 element PasswordBox e_13 = new PasswordBox(); e_4.Children.Add(e_13); e_13.Name = "e_13"; e_13.Width = 200F; e_13.Margin = new Thickness(5F, 5F, 5F, 5F); e_13.HorizontalAlignment = HorizontalAlignment.Left; e_13.TabIndex = 7; Grid.SetColumn(e_13, 1); Grid.SetRow(e_13, 8); Binding binding_e_13_Password = new Binding("Password"); e_13.SetBinding(PasswordBox.PasswordProperty, binding_e_13_Password); // e_14 element TextBlock e_14 = new TextBlock(); e_4.Children.Add(e_14); e_14.Name = "e_14"; e_14.VerticalAlignment = VerticalAlignment.Center; e_14.Text = "ComboBox"; Grid.SetRow(e_14, 9); // combo element ComboBox combo = new ComboBox(); e_4.Children.Add(combo); combo.Name = "combo"; combo.Width = 200F; combo.Margin = new Thickness(5F, 5F, 5F, 5F); combo.HorizontalAlignment = HorizontalAlignment.Left; combo.TabIndex = 8; combo.ItemsSource = Get_combo_Items(); combo.SelectedIndex = 2; Grid.SetColumn(combo, 1); Grid.SetRow(combo, 9); // e_15 element TextBlock e_15 = new TextBlock(); e_4.Children.Add(e_15); e_15.Name = "e_15"; e_15.VerticalAlignment = VerticalAlignment.Center; e_15.Text = "ListBox"; Grid.SetRow(e_15, 10); // e_16 element Grid e_16 = new Grid(); e_4.Children.Add(e_16); e_16.Name = "e_16"; ColumnDefinition col_e_16_0 = new ColumnDefinition(); e_16.ColumnDefinitions.Add(col_e_16_0); ColumnDefinition col_e_16_1 = new ColumnDefinition(); e_16.ColumnDefinitions.Add(col_e_16_1); Grid.SetColumn(e_16, 1); Grid.SetRow(e_16, 10); // e_17 element ListBox e_17 = new ListBox(); e_16.Children.Add(e_17); e_17.Name = "e_17"; e_17.TabIndex = 9; DragDrop.SetIsDragSource(e_17, true); DragDrop.SetIsDropTarget(e_17, true); Binding binding_e_17_ItemsSource = new Binding("DataOne"); e_17.SetBinding(ListBox.ItemsSourceProperty, binding_e_17_ItemsSource); // e_18 element ListBox e_18 = new ListBox(); e_16.Children.Add(e_18); e_18.Name = "e_18"; e_18.TabIndex = 10; Grid.SetColumn(e_18, 1); DragDrop.SetIsDragSource(e_18, true); DragDrop.SetIsDropTarget(e_18, true); Binding binding_e_18_ItemsSource = new Binding("DataTwo"); e_18.SetBinding(ListBox.ItemsSourceProperty, binding_e_18_ItemsSource); // e_19 element TextBlock e_19 = new TextBlock(); e_4.Children.Add(e_19); e_19.Name = "e_19"; e_19.VerticalAlignment = VerticalAlignment.Center; e_19.Text = "RadioButton"; Grid.SetRow(e_19, 11); // e_20 element StackPanel e_20 = new StackPanel(); e_4.Children.Add(e_20); e_20.Name = "e_20"; e_20.Orientation = Orientation.Horizontal; Grid.SetColumn(e_20, 1); Grid.SetRow(e_20, 11); // e_21 element RadioButton e_21 = new RadioButton(); e_20.Children.Add(e_21); e_21.Name = "e_21"; e_21.Margin = new Thickness(5F, 5F, 5F, 5F); e_21.Content = "Radio Button 1"; e_21.GroupName = "testGroup1"; // e_22 element RadioButton e_22 = new RadioButton(); e_20.Children.Add(e_22); e_22.Name = "e_22"; e_22.Margin = new Thickness(5F, 5F, 5F, 5F); e_22.Content = "Radio Button 2"; e_22.GroupName = "testGroup1"; // e_23 element RadioButton e_23 = new RadioButton(); e_20.Children.Add(e_23); e_23.Name = "e_23"; e_23.Margin = new Thickness(5F, 5F, 5F, 5F); e_23.Content = "Radio Button 3"; e_23.GroupName = "testGroup1"; // e_24 element RadioButton e_24 = new RadioButton(); e_20.Children.Add(e_24); e_24.Name = "e_24"; e_24.Margin = new Thickness(5F, 5F, 5F, 5F); e_24.Content = "Radio Button 4"; e_24.GroupName = "testGroup2"; // e_25 element RadioButton e_25 = new RadioButton(); e_20.Children.Add(e_25); e_25.Name = "e_25"; e_25.Margin = new Thickness(5F, 5F, 5F, 5F); e_25.Content = "Radio Button 5"; e_25.GroupName = "testGroup2"; // e_26 element RadioButton e_26 = new RadioButton(); e_20.Children.Add(e_26); e_26.Name = "e_26"; e_26.Margin = new Thickness(5F, 5F, 5F, 5F); e_26.Content = "Radio Button 6"; e_26.GroupName = "testGroup2"; items.Add(e_3); // e_27 element TabItem e_27 = new TabItem(); e_27.Name = "e_27"; e_27.Header = "DataGrid"; // e_28 element DataGrid e_28 = new DataGrid(); e_27.Content = e_28; e_28.Name = "e_28"; e_28.AutoGenerateColumns = false; DataGridTextColumn e_28_Col0 = new DataGridTextColumn(); e_28_Col0.Header = "#"; Binding e_28_Col0_b = new Binding("Number"); e_28_Col0.Binding = e_28_Col0_b; e_28.Columns.Add(e_28_Col0); DataGridTextColumn e_28_Col1 = new DataGridTextColumn(); e_28_Col1.Width = 200F; e_28_Col1.Header = "Text"; Style e_28_Col1_e_s = new Style(typeof(DataGridCell)); Setter e_28_Col1_e_s_S_0 = new Setter(DataGridCell.BackgroundProperty, new SolidColorBrush(new ColorW(128, 128, 128, 255))); e_28_Col1_e_s.Setters.Add(e_28_Col1_e_s_S_0); Setter e_28_Col1_e_s_S_1 = new Setter(DataGridCell.HorizontalAlignmentProperty, HorizontalAlignment.Center); e_28_Col1_e_s.Setters.Add(e_28_Col1_e_s_S_1); Setter e_28_Col1_e_s_S_2 = new Setter(DataGridCell.VerticalAlignmentProperty, VerticalAlignment.Center); e_28_Col1_e_s.Setters.Add(e_28_Col1_e_s_S_2); e_28_Col1.ElementStyle = e_28_Col1_e_s; Binding e_28_Col1_b = new Binding("Text"); e_28_Col1.Binding = e_28_Col1_b; e_28.Columns.Add(e_28_Col1); DataGridCheckBoxColumn e_28_Col2 = new DataGridCheckBoxColumn(); e_28_Col2.Width = DataGridLength.SizeToHeader; e_28_Col2.Header = "Bool"; Binding e_28_Col2_b = new Binding("Boolean"); e_28_Col2.Binding = e_28_Col2_b; e_28.Columns.Add(e_28_Col2); DataGridTemplateColumn e_28_Col3 = new DataGridTemplateColumn(); e_28_Col3.Width = new DataGridLength(1F, DataGridLengthUnitType.Star); // e_29 element TextBlock e_29 = new TextBlock(); e_29.Name = "e_29"; e_29.Text = "Template Column"; e_28_Col3.Header = e_29; Style e_28_Col3_h_s = new Style(typeof(DataGridColumnHeader)); Setter e_28_Col3_h_s_S_0 = new Setter(DataGridColumnHeader.ForegroundProperty, new SolidColorBrush(new ColorW(255, 165, 0, 255))); e_28_Col3_h_s.Setters.Add(e_28_Col3_h_s_S_0); e_28_Col3.HeaderStyle = e_28_Col3_h_s; Func<UIElement, UIElement> e_28_Col3_ct_dtFunc = e_28_Col3_ct_dtMethod; e_28_Col3.CellTemplate = new DataTemplate(e_28_Col3_ct_dtFunc); e_28.Columns.Add(e_28_Col3); Binding binding_e_28_ItemsSource = new Binding("GridData"); e_28.SetBinding(DataGrid.ItemsSourceProperty, binding_e_28_ItemsSource); items.Add(e_27); // e_35 element TabItem e_35 = new TabItem(); e_35.Name = "e_35"; e_35.Header = "TreeView"; // e_36 element TreeView e_36 = new TreeView(); e_35.Content = e_36; e_36.Name = "e_36"; Binding binding_e_36_ItemsSource = new Binding("TreeItems"); e_36.SetBinding(TreeView.ItemsSourceProperty, binding_e_36_ItemsSource); items.Add(e_35); // e_37 element TabItem e_37 = new TabItem(); e_37.Name = "e_37"; e_37.Header = "Chart"; // e_38 element Chart e_38 = new Chart(); e_37.Content = e_38; e_38.Name = "e_38"; e_38.AxisYMajorUnit = 50F; // e_39 element LineSeries2D e_39 = new LineSeries2D(); e_38.Series.Add(e_39); e_39.Name = "e_39"; // p_40 point SeriesPoint p_40 = new SeriesPoint(); e_39.Points.Add(p_40); p_40.Argument = 0F; p_40.Value = 0F; // p_41 point SeriesPoint p_41 = new SeriesPoint(); e_39.Points.Add(p_41); p_41.Argument = 1F; p_41.Value = 10F; // p_42 point SeriesPoint p_42 = new SeriesPoint(); e_39.Points.Add(p_42); p_42.Argument = 2F; p_42.Value = 20F; // p_43 point SeriesPoint p_43 = new SeriesPoint(); e_39.Points.Add(p_43); p_43.Argument = 3F; p_43.Value = 50F; // p_44 point SeriesPoint p_44 = new SeriesPoint(); e_39.Points.Add(p_44); p_44.Argument = 4F; p_44.Value = 100F; // p_45 point SeriesPoint p_45 = new SeriesPoint(); e_39.Points.Add(p_45); p_45.Argument = 5F; p_45.Value = 200F; // p_46 point SeriesPoint p_46 = new SeriesPoint(); e_39.Points.Add(p_46); p_46.Argument = 6F; p_46.Value = 500F; // e_47 element LineSeries2D e_47 = new LineSeries2D(); e_38.Series.Add(e_47); e_47.Name = "e_47"; e_47.Foreground = new SolidColorBrush(new ColorW(255, 165, 0, 255)); e_47.LineThickness = 1F; Binding binding_e_47_DataSource = new Binding("ChartData"); e_47.SetBinding(LineSeries2D.DataSourceProperty, binding_e_47_DataSource); items.Add(e_37); // e_48 element TabItem e_48 = new TabItem(); e_48.Name = "e_48"; e_48.Header = "Shapes"; // e_49 element Grid e_49 = new Grid(); e_48.Content = e_49; e_49.Name = "e_49"; RowDefinition row_e_49_0 = new RowDefinition(); e_49.RowDefinitions.Add(row_e_49_0); RowDefinition row_e_49_1 = new RowDefinition(); e_49.RowDefinitions.Add(row_e_49_1); RowDefinition row_e_49_2 = new RowDefinition(); e_49.RowDefinitions.Add(row_e_49_2); ColumnDefinition col_e_49_0 = new ColumnDefinition(); e_49.ColumnDefinitions.Add(col_e_49_0); ColumnDefinition col_e_49_1 = new ColumnDefinition(); e_49.ColumnDefinitions.Add(col_e_49_1); ColumnDefinition col_e_49_2 = new ColumnDefinition(); e_49.ColumnDefinitions.Add(col_e_49_2); // e_50 element Rectangle e_50 = new Rectangle(); e_49.Children.Add(e_50); e_50.Name = "e_50"; e_50.Height = 100F; e_50.Width = 200F; e_50.Margin = new Thickness(5F, 5F, 5F, 5F); e_50.Fill = new SolidColorBrush(new ColorW(0, 128, 0, 255)); e_50.Stroke = new SolidColorBrush(new ColorW(128, 128, 128, 255)); e_50.StrokeThickness = 5F; e_50.RadiusX = 10F; e_50.RadiusY = 10F; // e_51 element Rectangle e_51 = new Rectangle(); e_49.Children.Add(e_51); e_51.Name = "e_51"; e_51.Height = 100F; e_51.Width = 200F; e_51.Margin = new Thickness(5F, 5F, 5F, 5F); e_51.Fill = new SolidColorBrush(new ColorW(255, 165, 0, 255)); Grid.SetColumn(e_51, 1); // e_52 element Rectangle e_52 = new Rectangle(); e_49.Children.Add(e_52); e_52.Name = "e_52"; e_52.Height = 100F; e_52.Width = 200F; e_52.Margin = new Thickness(5F, 5F, 5F, 5F); LinearGradientBrush e_52_Fill = new LinearGradientBrush(); e_52_Fill.StartPoint = new PointF(0F, 0F); e_52_Fill.EndPoint = new PointF(1F, 1F); e_52_Fill.SpreadMethod = GradientSpreadMethod.Pad; e_52_Fill.GradientStops.Add(new GradientStop(new ColorW(255, 165, 0, 255), 0.5F)); e_52_Fill.GradientStops.Add(new GradientStop(new ColorW(0, 162, 255, 255), 0F)); e_52.Fill = e_52_Fill; LinearGradientBrush e_52_Stroke = new LinearGradientBrush(); e_52_Stroke.StartPoint = new PointF(0F, 0F); e_52_Stroke.EndPoint = new PointF(1F, 1F); e_52_Stroke.SpreadMethod = GradientSpreadMethod.Pad; e_52_Stroke.GradientStops.Add(new GradientStop(new ColorW(0, 162, 255, 255), 0.5F)); e_52_Stroke.GradientStops.Add(new GradientStop(new ColorW(255, 165, 0, 255), 0F)); e_52.Stroke = e_52_Stroke; e_52.StrokeThickness = 5F; e_52.RadiusX = 10F; e_52.RadiusY = 10F; Grid.SetColumn(e_52, 2); // e_53 element Ellipse e_53 = new Ellipse(); e_49.Children.Add(e_53); e_53.Name = "e_53"; e_53.Height = 100F; e_53.Width = 200F; e_53.Margin = new Thickness(5F, 5F, 5F, 5F); e_53.Fill = new SolidColorBrush(new ColorW(128, 128, 128, 255)); e_53.Stroke = new SolidColorBrush(new ColorW(0, 128, 0, 255)); e_53.StrokeThickness = 10F; Grid.SetRow(e_53, 1); // e_54 element Ellipse e_54 = new Ellipse(); e_49.Children.Add(e_54); e_54.Name = "e_54"; e_54.Height = 100F; e_54.Width = 200F; e_54.Margin = new Thickness(5F, 5F, 5F, 5F); e_54.Stroke = new SolidColorBrush(new ColorW(255, 165, 0, 255)); e_54.StrokeThickness = 10F; Grid.SetColumn(e_54, 1); Grid.SetRow(e_54, 1); // e_55 element Ellipse e_55 = new Ellipse(); e_49.Children.Add(e_55); e_55.Name = "e_55"; e_55.Height = 100F; e_55.Width = 200F; e_55.Margin = new Thickness(5F, 5F, 5F, 5F); LinearGradientBrush e_55_Fill = new LinearGradientBrush(); e_55_Fill.StartPoint = new PointF(0F, 0F); e_55_Fill.EndPoint = new PointF(1F, 1F); e_55_Fill.SpreadMethod = GradientSpreadMethod.Pad; e_55_Fill.GradientStops.Add(new GradientStop(new ColorW(255, 165, 0, 255), 0.5F)); e_55_Fill.GradientStops.Add(new GradientStop(new ColorW(0, 162, 255, 255), 0F)); e_55.Fill = e_55_Fill; LinearGradientBrush e_55_Stroke = new LinearGradientBrush(); e_55_Stroke.StartPoint = new PointF(0F, 0F); e_55_Stroke.EndPoint = new PointF(1F, 1F); e_55_Stroke.SpreadMethod = GradientSpreadMethod.Pad; e_55_Stroke.GradientStops.Add(new GradientStop(new ColorW(0, 162, 255, 255), 0.5F)); e_55_Stroke.GradientStops.Add(new GradientStop(new ColorW(255, 165, 0, 255), 0F)); e_55.Stroke = e_55_Stroke; e_55.StrokeThickness = 10F; Grid.SetColumn(e_55, 2); Grid.SetRow(e_55, 1); // e_56 element Line e_56 = new Line(); e_49.Children.Add(e_56); e_56.Name = "e_56"; e_56.Stroke = new SolidColorBrush(new ColorW(128, 128, 128, 255)); e_56.StrokeThickness = 10F; e_56.X1 = 10F; e_56.X2 = 150F; e_56.Y1 = 10F; e_56.Y2 = 150F; Grid.SetRow(e_56, 2); // e_57 element Line e_57 = new Line(); e_49.Children.Add(e_57); e_57.Name = "e_57"; e_57.Stroke = new SolidColorBrush(new ColorW(128, 128, 128, 255)); e_57.StrokeThickness = 10F; e_57.X1 = 100F; e_57.X2 = 100F; e_57.Y1 = 10F; e_57.Y2 = 100F; Grid.SetRow(e_57, 2); // e_58 element Line e_58 = new Line(); e_49.Children.Add(e_58); e_58.Name = "e_58"; e_58.Stroke = new SolidColorBrush(new ColorW(128, 128, 128, 255)); e_58.StrokeThickness = 10F; e_58.X1 = 10F; e_58.X2 = 100F; e_58.Y1 = 100F; e_58.Y2 = 100F; Grid.SetRow(e_58, 2); // e_59 element Rectangle e_59 = new Rectangle(); e_49.Children.Add(e_59); e_59.Name = "e_59"; e_59.Height = 100F; e_59.Width = 200F; e_59.Margin = new Thickness(5F, 5F, 5F, 5F); ImageBrush e_59_Fill = new ImageBrush(); BitmapImage e_59_Fill_bm = new BitmapImage(); e_59_Fill_bm.TextureAsset = "Images/MonoGameLogo"; e_59_Fill.ImageSource = e_59_Fill_bm; e_59_Fill.Stretch = Stretch.None; e_59.Fill = e_59_Fill; e_59.Stroke = new SolidColorBrush(new ColorW(255, 255, 255, 255)); e_59.StrokeThickness = 1F; e_59.RadiusX = 10F; e_59.RadiusY = 10F; Grid.SetColumn(e_59, 1); Grid.SetRow(e_59, 2); // e_60 element Image e_60 = new Image(); e_49.Children.Add(e_60); e_60.Name = "e_60"; Grid.SetColumn(e_60, 2); Grid.SetRow(e_60, 2); Binding binding_e_60_Source = new Binding("RenderTargetSource"); e_60.SetBinding(Image.SourceProperty, binding_e_60_Source); items.Add(e_48); // e_61 element TabItem e_61 = new TabItem(); e_61.Name = "e_61"; e_61.Header = "Animations"; // e_62 element Grid e_62 = new Grid(); e_61.Content = e_62; e_62.Name = "e_62"; ColumnDefinition col_e_62_0 = new ColumnDefinition(); e_62.ColumnDefinitions.Add(col_e_62_0); ColumnDefinition col_e_62_1 = new ColumnDefinition(); e_62.ColumnDefinitions.Add(col_e_62_1); // e_63 element StackPanel e_63 = new StackPanel(); e_62.Children.Add(e_63); e_63.Name = "e_63"; // animButton1 element Button animButton1 = new Button(); e_63.Children.Add(animButton1); animButton1.Name = "animButton1"; animButton1.TabIndex = 1; animButton1.Content = "Mouse Over me!"; animButton1.SetResourceReference(Button.StyleProperty, "buttonAnimStyle"); // animButton2 element Button animButton2 = new Button(); e_63.Children.Add(animButton2); animButton2.Name = "animButton2"; animButton2.TabIndex = 2; animButton2.Content = "Mouse Over me!"; animButton2.SetResourceReference(Button.StyleProperty, "buttonAnimStyle"); // animButton3 element Button animButton3 = new Button(); e_63.Children.Add(animButton3); animButton3.Name = "animButton3"; animButton3.TabIndex = 3; animButton3.Content = "Mouse Over me!"; animButton3.SetResourceReference(Button.StyleProperty, "buttonAnimStyle"); // animButton4 element Button animButton4 = new Button(); e_63.Children.Add(animButton4); animButton4.Name = "animButton4"; animButton4.TabIndex = 4; animButton4.Content = "Mouse Over me!"; animButton4.SetResourceReference(Button.StyleProperty, "buttonAnimStyle"); // animBorder1 element Border animBorder1 = new Border(); e_62.Children.Add(animBorder1); animBorder1.Name = "animBorder1"; animBorder1.Height = 100F; animBorder1.Width = 200F; animBorder1.Margin = new Thickness(0F, 10F, 0F, 10F); animBorder1.VerticalAlignment = VerticalAlignment.Top; EventTrigger animBorder1_ET_0 = new EventTrigger(Border.LoadedEvent, animBorder1); animBorder1.Triggers.Add(animBorder1_ET_0); BeginStoryboard animBorder1_ET_0_AC_0 = new BeginStoryboard(); animBorder1_ET_0_AC_0.Name = "animBorder1_ET_0_AC_0"; animBorder1_ET_0.AddAction(animBorder1_ET_0_AC_0); Storyboard animBorder1_ET_0_AC_0_SB = new Storyboard(); animBorder1_ET_0_AC_0.Storyboard = animBorder1_ET_0_AC_0_SB; animBorder1_ET_0_AC_0_SB.Name = "animBorder1_ET_0_AC_0_SB"; SolidColorBrushAnimation animBorder1_ET_0_AC_0_SB_TL_0 = new SolidColorBrushAnimation(); animBorder1_ET_0_AC_0_SB_TL_0.Name = "animBorder1_ET_0_AC_0_SB_TL_0"; animBorder1_ET_0_AC_0_SB_TL_0.AutoReverse = true; animBorder1_ET_0_AC_0_SB_TL_0.Duration = new Duration(new TimeSpan(0, 0, 0, 5, 0)); animBorder1_ET_0_AC_0_SB_TL_0.RepeatBehavior = RepeatBehavior.Forever; animBorder1_ET_0_AC_0_SB_TL_0.From = new ColorW(255, 255, 0, 255); animBorder1_ET_0_AC_0_SB_TL_0.To = new ColorW(0, 0, 255, 255); ExponentialEase animBorder1_ET_0_AC_0_SB_TL_0_EA = new ExponentialEase(); animBorder1_ET_0_AC_0_SB_TL_0.EasingFunction = animBorder1_ET_0_AC_0_SB_TL_0_EA; Storyboard.SetTargetName(animBorder1_ET_0_AC_0_SB_TL_0, "animBorder1"); Storyboard.SetTargetProperty(animBorder1_ET_0_AC_0_SB_TL_0, Border.BackgroundProperty); animBorder1_ET_0_AC_0_SB.Children.Add(animBorder1_ET_0_AC_0_SB_TL_0); Grid.SetColumn(animBorder1, 1); // animBorder2 element Border animBorder2 = new Border(); e_62.Children.Add(animBorder2); animBorder2.Name = "animBorder2"; animBorder2.Height = 50F; animBorder2.Width = 100F; animBorder2.Margin = new Thickness(50F, 35F, 50F, 35F); animBorder2.VerticalAlignment = VerticalAlignment.Top; EventTrigger animBorder2_ET_0 = new EventTrigger(Border.LoadedEvent, animBorder2); animBorder2.Triggers.Add(animBorder2_ET_0); BeginStoryboard animBorder2_ET_0_AC_0 = new BeginStoryboard(); animBorder2_ET_0_AC_0.Name = "animBorder2_ET_0_AC_0"; animBorder2_ET_0.AddAction(animBorder2_ET_0_AC_0); Storyboard animBorder2_ET_0_AC_0_SB = new Storyboard(); animBorder2_ET_0_AC_0.Storyboard = animBorder2_ET_0_AC_0_SB; animBorder2_ET_0_AC_0_SB.Name = "animBorder2_ET_0_AC_0_SB"; SolidColorBrushAnimation animBorder2_ET_0_AC_0_SB_TL_0 = new SolidColorBrushAnimation(); animBorder2_ET_0_AC_0_SB_TL_0.Name = "animBorder2_ET_0_AC_0_SB_TL_0"; animBorder2_ET_0_AC_0_SB_TL_0.AutoReverse = true; animBorder2_ET_0_AC_0_SB_TL_0.Duration = new Duration(new TimeSpan(0, 0, 0, 3, 0)); animBorder2_ET_0_AC_0_SB_TL_0.RepeatBehavior = RepeatBehavior.Forever; animBorder2_ET_0_AC_0_SB_TL_0.From = new ColorW(255, 0, 0, 255); animBorder2_ET_0_AC_0_SB_TL_0.To = new ColorW(255, 255, 255, 255); CubicEase animBorder2_ET_0_AC_0_SB_TL_0_EA = new CubicEase(); animBorder2_ET_0_AC_0_SB_TL_0.EasingFunction = animBorder2_ET_0_AC_0_SB_TL_0_EA; Storyboard.SetTargetName(animBorder2_ET_0_AC_0_SB_TL_0, "animBorder2"); Storyboard.SetTargetProperty(animBorder2_ET_0_AC_0_SB_TL_0, Border.BackgroundProperty); animBorder2_ET_0_AC_0_SB.Children.Add(animBorder2_ET_0_AC_0_SB_TL_0); FloatAnimation animBorder2_ET_0_AC_0_SB_TL_1 = new FloatAnimation(); animBorder2_ET_0_AC_0_SB_TL_1.Name = "animBorder2_ET_0_AC_0_SB_TL_1"; animBorder2_ET_0_AC_0_SB_TL_1.AutoReverse = true; animBorder2_ET_0_AC_0_SB_TL_1.Duration = new Duration(new TimeSpan(0, 0, 0, 4, 0)); animBorder2_ET_0_AC_0_SB_TL_1.RepeatBehavior = RepeatBehavior.Forever; animBorder2_ET_0_AC_0_SB_TL_1.From = 1F; animBorder2_ET_0_AC_0_SB_TL_1.To = 0F; Storyboard.SetTargetName(animBorder2_ET_0_AC_0_SB_TL_1, "animBorder2"); Storyboard.SetTargetProperty(animBorder2_ET_0_AC_0_SB_TL_1, Border.OpacityProperty); animBorder2_ET_0_AC_0_SB.Children.Add(animBorder2_ET_0_AC_0_SB_TL_1); Grid.SetColumn(animBorder2, 1); items.Add(e_61); // e_64 element TabItem e_64 = new TabItem(); e_64.Name = "e_64"; e_64.Header = "Tetris"; // e_65 element Border e_65 = new Border(); e_64.Content = e_65; e_65.Name = "e_65"; // e_66 element Grid e_66 = new Grid(); e_65.Child = e_66; e_66.Name = "e_66"; e_66.Margin = new Thickness(10F, 10F, 10F, 10F); RowDefinition row_e_66_0 = new RowDefinition(); row_e_66_0.Height = new GridLength(1F, GridUnitType.Auto); e_66.RowDefinitions.Add(row_e_66_0); RowDefinition row_e_66_1 = new RowDefinition(); row_e_66_1.Height = new GridLength(420F, GridUnitType.Pixel); e_66.RowDefinitions.Add(row_e_66_1); ColumnDefinition col_e_66_0 = new ColumnDefinition(); e_66.ColumnDefinitions.Add(col_e_66_0); ColumnDefinition col_e_66_1 = new ColumnDefinition(); e_66.ColumnDefinitions.Add(col_e_66_1); ColumnDefinition col_e_66_2 = new ColumnDefinition(); e_66.ColumnDefinitions.Add(col_e_66_2); // e_67 element StackPanel e_67 = new StackPanel(); e_66.Children.Add(e_67); e_67.Name = "e_67"; e_67.HorizontalAlignment = HorizontalAlignment.Right; e_67.Orientation = Orientation.Vertical; Grid.SetRow(e_67, 1); // e_68 element TextBlock e_68 = new TextBlock(); e_67.Children.Add(e_68); e_68.Name = "e_68"; e_68.Text = "Next"; // e_69 element Border e_69 = new Border(); e_67.Children.Add(e_69); e_69.Name = "e_69"; e_69.Height = 81F; e_69.Width = 81F; e_69.BorderBrush = new SolidColorBrush(new ColorW(255, 255, 255, 255)); e_69.BorderThickness = new Thickness(0F, 0F, 1F, 1F); // tetrisNextContainer1 element Canvas tetrisNextContainer1 = new Canvas(); e_69.Child = tetrisNextContainer1; tetrisNextContainer1.Name = "tetrisNextContainer1"; tetrisNextContainer1.Height = 80F; tetrisNextContainer1.Width = 80F; // e_70 element Border e_70 = new Border(); e_66.Children.Add(e_70); e_70.Name = "e_70"; e_70.Height = 401F; e_70.Width = 201F; e_70.BorderBrush = new SolidColorBrush(new ColorW(255, 255, 255, 255)); e_70.BorderThickness = new Thickness(0F, 0F, 1F, 1F); Grid.SetColumn(e_70, 1); Grid.SetRow(e_70, 1); // tetrisContainer1 element Canvas tetrisContainer1 = new Canvas(); e_70.Child = tetrisContainer1; tetrisContainer1.Name = "tetrisContainer1"; tetrisContainer1.Height = 400F; tetrisContainer1.Width = 200F; tetrisContainer1.HorizontalAlignment = HorizontalAlignment.Left; tetrisContainer1.VerticalAlignment = VerticalAlignment.Top; // e_71 element Grid e_71 = new Grid(); e_66.Children.Add(e_71); e_71.Name = "e_71"; RowDefinition row_e_71_0 = new RowDefinition(); row_e_71_0.Height = new GridLength(1F, GridUnitType.Auto); e_71.RowDefinitions.Add(row_e_71_0); RowDefinition row_e_71_1 = new RowDefinition(); row_e_71_1.Height = new GridLength(1F, GridUnitType.Auto); e_71.RowDefinitions.Add(row_e_71_1); ColumnDefinition col_e_71_0 = new ColumnDefinition(); col_e_71_0.Width = new GridLength(1F, GridUnitType.Auto); e_71.ColumnDefinitions.Add(col_e_71_0); ColumnDefinition col_e_71_1 = new ColumnDefinition(); col_e_71_1.Width = new GridLength(1F, GridUnitType.Star); e_71.ColumnDefinitions.Add(col_e_71_1); ColumnDefinition col_e_71_2 = new ColumnDefinition(); col_e_71_2.Width = new GridLength(1F, GridUnitType.Auto); e_71.ColumnDefinitions.Add(col_e_71_2); Grid.SetColumnSpan(e_71, 3); Binding binding_e_71_DataContext = new Binding("Tetris"); e_71.SetBinding(Grid.DataContextProperty, binding_e_71_DataContext); // e_72 element Button e_72 = new Button(); e_71.Children.Add(e_72); e_72.Name = "e_72"; e_72.Height = 30F; e_72.Content = "Start"; Grid.SetColumnSpan(e_72, 3); Binding binding_e_72_Command = new Binding("StartCommand"); e_72.SetBinding(Button.CommandProperty, binding_e_72_Command); // e_73 element Grid e_73 = new Grid(); e_71.Children.Add(e_73); e_73.Name = "e_73"; RowDefinition row_e_73_0 = new RowDefinition(); row_e_73_0.Height = new GridLength(1F, GridUnitType.Auto); e_73.RowDefinitions.Add(row_e_73_0); ColumnDefinition col_e_73_0 = new ColumnDefinition(); e_73.ColumnDefinitions.Add(col_e_73_0); ColumnDefinition col_e_73_1 = new ColumnDefinition(); col_e_73_1.Width = new GridLength(70F, GridUnitType.Pixel); e_73.ColumnDefinitions.Add(col_e_73_1); ColumnDefinition col_e_73_2 = new ColumnDefinition(); e_73.ColumnDefinitions.Add(col_e_73_2); Grid.SetColumn(e_73, 1); Grid.SetRow(e_73, 1); // spPlayer1 element StackPanel spPlayer1 = new StackPanel(); e_73.Children.Add(spPlayer1); spPlayer1.Name = "spPlayer1"; spPlayer1.HorizontalAlignment = HorizontalAlignment.Right; spPlayer1.Orientation = Orientation.Vertical; // e_74 element TextBlock e_74 = new TextBlock(); spPlayer1.Children.Add(e_74); e_74.Name = "e_74"; Binding binding_e_74_Text = new Binding("Score"); e_74.SetBinding(TextBlock.TextProperty, binding_e_74_Text); // e_75 element TextBlock e_75 = new TextBlock(); spPlayer1.Children.Add(e_75); e_75.Name = "e_75"; Binding binding_e_75_Text = new Binding("Lines"); e_75.SetBinding(TextBlock.TextProperty, binding_e_75_Text); // e_76 element TextBlock e_76 = new TextBlock(); spPlayer1.Children.Add(e_76); e_76.Name = "e_76"; Binding binding_e_76_Text = new Binding("Level"); e_76.SetBinding(TextBlock.TextProperty, binding_e_76_Text); // e_77 element StackPanel e_77 = new StackPanel(); e_73.Children.Add(e_77); e_77.Name = "e_77"; e_77.HorizontalAlignment = HorizontalAlignment.Center; e_77.Orientation = Orientation.Vertical; Grid.SetColumn(e_77, 1); // e_78 element TextBlock e_78 = new TextBlock(); e_77.Children.Add(e_78); e_78.Name = "e_78"; e_78.Text = "SCORE"; // e_79 element TextBlock e_79 = new TextBlock(); e_77.Children.Add(e_79); e_79.Name = "e_79"; e_79.Text = "LINES"; // e_80 element TextBlock e_80 = new TextBlock(); e_77.Children.Add(e_80); e_80.Name = "e_80"; e_80.Text = "LEVEL"; // e_81 element StackPanel e_81 = new StackPanel(); e_73.Children.Add(e_81); e_81.Name = "e_81"; e_81.HorizontalAlignment = HorizontalAlignment.Left; e_81.Orientation = Orientation.Horizontal; // e_82 element TextBlock e_82 = new TextBlock(); e_81.Children.Add(e_82); e_82.Name = "e_82"; e_82.Text = "Use A,S,D,W for left, down, right, rotate"; items.Add(e_64); // e_83 element TabItem e_83 = new TabItem(); e_83.Name = "e_83"; e_83.Header = "User Control"; // e_84 element UserControlTest e_84 = new UserControlTest(); e_83.Content = e_84; e_84.Name = "e_84"; items.Add(e_83); return items; }
public StoryboardExample() { // Create a name scope for the page. NameScope.SetNameScope(this, new NameScope()); this.WindowTitle = "Animate Properties using Storyboards"; StackPanel myStackPanel = new StackPanel(); myStackPanel.MinWidth = 500; myStackPanel.Margin = new Thickness(30); myStackPanel.HorizontalAlignment = HorizontalAlignment.Left; TextBlock myTextBlock = new TextBlock(); myTextBlock.Text = "Storyboard Animation Example"; myStackPanel.Children.Add(myTextBlock); // // Create and animate the first button. // // Create a button. Button myWidthAnimatedButton = new Button(); myWidthAnimatedButton.Height = 30; myWidthAnimatedButton.Width = 200; myWidthAnimatedButton.HorizontalAlignment = HorizontalAlignment.Left; myWidthAnimatedButton.Content = "A Button"; // Set the Name of the button so that it can be referred // to in the storyboard that's created later. // The ID doesn't have to match the variable name; // it can be any unique identifier. myWidthAnimatedButton.Name = "myWidthAnimatedButton"; // Register the name with the page to which the button belongs. this.RegisterName(myWidthAnimatedButton.Name, myWidthAnimatedButton); // Create a DoubleAnimation to animate the width of the button. DoubleAnimation myDoubleAnimation = new DoubleAnimation(); myDoubleAnimation.From = 200; myDoubleAnimation.To = 300; myDoubleAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(3000)); // Configure the animation to target the button's Width property. Storyboard.SetTargetName(myDoubleAnimation, myWidthAnimatedButton.Name); Storyboard.SetTargetProperty(myDoubleAnimation, new PropertyPath(Button.WidthProperty)); // Create a storyboard to contain the animation. Storyboard myWidthAnimatedButtonStoryboard = new Storyboard(); myWidthAnimatedButtonStoryboard.Children.Add(myDoubleAnimation); // Create an EventTrigger and a BeginStoryboard action to // start the animation. EventTrigger myWidthAnimatedButtonClickEventTrigger = new EventTrigger(); myWidthAnimatedButtonClickEventTrigger.RoutedEvent = Button.ClickEvent; BeginStoryboard myBeginWidthAnimatedStoryboard = new BeginStoryboard(); myBeginWidthAnimatedStoryboard.Storyboard = myWidthAnimatedButtonStoryboard; myWidthAnimatedButtonClickEventTrigger.Actions.Add(myBeginWidthAnimatedStoryboard); myWidthAnimatedButton.Triggers.Add(myWidthAnimatedButtonClickEventTrigger); myStackPanel.Children.Add(myWidthAnimatedButton); // // Create and animate the second button. // // Create a second button. Button myColorAnimatedButton = new Button(); myColorAnimatedButton.Height = 30; myColorAnimatedButton.Width = 200; myColorAnimatedButton.HorizontalAlignment = HorizontalAlignment.Left; myColorAnimatedButton.Content = "Another Button"; // Create a SolidColorBrush to paint the button's background. SolidColorBrush myBackgroundBrush = new SolidColorBrush(); myBackgroundBrush.Color = Colors.Blue; // Because a Brush isn't a FrameworkElement, it doesn't // have a Name property to set. Instead, you just // register a name for the SolidColorBrush with // the page where it's used. this.RegisterName("myAnimatedBrush", myBackgroundBrush); // Use the brush to paint the background of the button. myColorAnimatedButton.Background = myBackgroundBrush; // Create a ColorAnimation to animate the button's background. ColorAnimation myColorAnimation = new ColorAnimation(); myColorAnimation.From = Colors.Red; myColorAnimation.To = Colors.Blue; myColorAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(7000)); // Configure the animation to target the brush's Color property. Storyboard.SetTargetName(myColorAnimation, "myAnimatedBrush"); Storyboard.SetTargetProperty(myColorAnimation, new PropertyPath(SolidColorBrush.ColorProperty)); // Create a storyboard to contain the animation. Storyboard myColorAnimatedButtonStoryboard = new Storyboard(); myColorAnimatedButtonStoryboard.Children.Add(myColorAnimation); // Create an EventTrigger and a BeginStoryboard to apply the animation. EventTrigger myColorAnimatedButtonClickEventTrigger = new EventTrigger(); myColorAnimatedButtonClickEventTrigger.RoutedEvent = Button.ClickEvent; BeginStoryboard myBeginColorAnimatedStoryboard = new BeginStoryboard(); myBeginColorAnimatedStoryboard.Storyboard = myColorAnimatedButtonStoryboard; myColorAnimatedButtonClickEventTrigger.Actions.Add(myBeginColorAnimatedStoryboard); myColorAnimatedButton.Triggers.Add(myColorAnimatedButtonClickEventTrigger); myStackPanel.Children.Add(myColorAnimatedButton); this.Content = myStackPanel; }
private void InitializeResources() { // Resource - [buttonStyle] Style var r_0_s_bo = this[typeof(Button)]; Style r_0_s = new Style(typeof(Button), r_0_s_bo as Style); Setter r_0_s_S_0 = new Setter(Button.BackgroundProperty, new SolidColorBrush(new ColorW(255, 140, 0, 255))); r_0_s.Setters.Add(r_0_s_S_0); this.Add("buttonStyle", r_0_s); // Resource - [Image] BitmapImage BitmapImage r_1_bm = new BitmapImage(); r_1_bm.TextureAsset = "Images/MonoGameLogo"; this.Add("Image", r_1_bm); // Resource - [TetrisWindowBackground] SolidColorBrush this.Add("TetrisWindowBackground", new SolidColorBrush(new ColorW(0, 0, 0, 255))); // Resource - [TetrisForeground] SolidColorBrush this.Add("TetrisForeground", new SolidColorBrush(new ColorW(255, 255, 255, 255))); // Resource - [TitleResource] String this.Add("TitleResource", "Basic UI Example"); // Resource - [TetrisBorderStyle] Style Style r_5_s = new Style(typeof(Border)); Setter r_5_s_S_0 = new Setter(Border.SnapsToDevicePixelsProperty, true); r_5_s.Setters.Add(r_5_s_S_0); Setter r_5_s_S_1 = new Setter(Border.BackgroundProperty, new ResourceReferenceExpression("TetrisWindowBackground")); r_5_s.Setters.Add(r_5_s_S_1); Setter r_5_s_S_2 = new Setter(Border.BorderBrushProperty, new ResourceReferenceExpression("TetrisBorderBrush")); r_5_s.Setters.Add(r_5_s_S_2); Setter r_5_s_S_3 = new Setter(Border.BorderThicknessProperty, new Thickness(1F)); r_5_s.Setters.Add(r_5_s_S_3); Setter r_5_s_S_4 = new Setter(Border.OpacityProperty, 0.9F); r_5_s.Setters.Add(r_5_s_S_4); this.Add("TetrisBorderStyle", r_5_s); // Resource - [DataTemplateKey(GameData.TestTreeDataItem)] DataTemplate Func<UIElement, UIElement> r_6_dtFunc = r_6_dtMethod; this.Add(typeof(GameData.TestTreeDataItem), new DataTemplate(typeof(GameData.TestTreeDataItem), r_6_dtFunc)); // Resource - [CustomWindowTemplate] ControlTemplate Func<UIElement, UIElement> r_7_ctFunc = r_7_ctMethod; ControlTemplate r_7_ct = new ControlTemplate(r_7_ctFunc); this.Add("CustomWindowTemplate", r_7_ct); // Resource - [buttonAnimStyle] Style var r_8_s_bo = this[typeof(Button)]; Style r_8_s = new Style(typeof(Button), r_8_s_bo as Style); Setter r_8_s_S_0 = new Setter(Button.WidthProperty, 200F); r_8_s.Setters.Add(r_8_s_S_0); Setter r_8_s_S_1 = new Setter(Button.MarginProperty, new Thickness(0F, 1F, 0F, 1F)); r_8_s.Setters.Add(r_8_s_S_1); Setter r_8_s_S_2 = new Setter(Button.SnapsToDevicePixelsProperty, false); r_8_s.Setters.Add(r_8_s_S_2); EventTrigger r_8_s_ET_0 = new EventTrigger(Button.MouseEnterEvent); r_8_s.Triggers.Add(r_8_s_ET_0); BeginStoryboard r_8_s_ET_0_AC_0 = new BeginStoryboard(); r_8_s_ET_0_AC_0.Name = "r_8_s_ET_0_AC_0"; r_8_s_ET_0.AddAction(r_8_s_ET_0_AC_0); Storyboard r_8_s_ET_0_AC_0_SB = new Storyboard(); r_8_s_ET_0_AC_0.Storyboard = r_8_s_ET_0_AC_0_SB; r_8_s_ET_0_AC_0_SB.Name = "r_8_s_ET_0_AC_0_SB"; ThicknessAnimation r_8_s_ET_0_AC_0_SB_TL_0 = new ThicknessAnimation(); r_8_s_ET_0_AC_0_SB_TL_0.Name = "r_8_s_ET_0_AC_0_SB_TL_0"; r_8_s_ET_0_AC_0_SB_TL_0.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500)); r_8_s_ET_0_AC_0_SB_TL_0.From = new Thickness(0F, 1F, 0F, 1F); r_8_s_ET_0_AC_0_SB_TL_0.To = new Thickness(0F, 5F, 0F, 5F); SineEase r_8_s_ET_0_AC_0_SB_TL_0_EA = new SineEase(); r_8_s_ET_0_AC_0_SB_TL_0.EasingFunction = r_8_s_ET_0_AC_0_SB_TL_0_EA; Storyboard.SetTargetProperty(r_8_s_ET_0_AC_0_SB_TL_0, Button.MarginProperty); r_8_s_ET_0_AC_0_SB.Children.Add(r_8_s_ET_0_AC_0_SB_TL_0); FloatAnimation r_8_s_ET_0_AC_0_SB_TL_1 = new FloatAnimation(); r_8_s_ET_0_AC_0_SB_TL_1.Name = "r_8_s_ET_0_AC_0_SB_TL_1"; r_8_s_ET_0_AC_0_SB_TL_1.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500)); r_8_s_ET_0_AC_0_SB_TL_1.To = 220F; SineEase r_8_s_ET_0_AC_0_SB_TL_1_EA = new SineEase(); r_8_s_ET_0_AC_0_SB_TL_1.EasingFunction = r_8_s_ET_0_AC_0_SB_TL_1_EA; Storyboard.SetTargetProperty(r_8_s_ET_0_AC_0_SB_TL_1, Button.WidthProperty); r_8_s_ET_0_AC_0_SB.Children.Add(r_8_s_ET_0_AC_0_SB_TL_1); EventTrigger r_8_s_ET_1 = new EventTrigger(Button.MouseLeaveEvent); r_8_s.Triggers.Add(r_8_s_ET_1); BeginStoryboard r_8_s_ET_1_AC_0 = new BeginStoryboard(); r_8_s_ET_1_AC_0.Name = "r_8_s_ET_1_AC_0"; r_8_s_ET_1.AddAction(r_8_s_ET_1_AC_0); Storyboard r_8_s_ET_1_AC_0_SB = new Storyboard(); r_8_s_ET_1_AC_0.Storyboard = r_8_s_ET_1_AC_0_SB; r_8_s_ET_1_AC_0_SB.Name = "r_8_s_ET_1_AC_0_SB"; ThicknessAnimation r_8_s_ET_1_AC_0_SB_TL_0 = new ThicknessAnimation(); r_8_s_ET_1_AC_0_SB_TL_0.Name = "r_8_s_ET_1_AC_0_SB_TL_0"; r_8_s_ET_1_AC_0_SB_TL_0.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500)); r_8_s_ET_1_AC_0_SB_TL_0.From = new Thickness(0F, 5F, 0F, 5F); r_8_s_ET_1_AC_0_SB_TL_0.To = new Thickness(0F, 1F, 0F, 1F); SineEase r_8_s_ET_1_AC_0_SB_TL_0_EA = new SineEase(); r_8_s_ET_1_AC_0_SB_TL_0.EasingFunction = r_8_s_ET_1_AC_0_SB_TL_0_EA; Storyboard.SetTargetProperty(r_8_s_ET_1_AC_0_SB_TL_0, Button.MarginProperty); r_8_s_ET_1_AC_0_SB.Children.Add(r_8_s_ET_1_AC_0_SB_TL_0); FloatAnimation r_8_s_ET_1_AC_0_SB_TL_1 = new FloatAnimation(); r_8_s_ET_1_AC_0_SB_TL_1.Name = "r_8_s_ET_1_AC_0_SB_TL_1"; r_8_s_ET_1_AC_0_SB_TL_1.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500)); r_8_s_ET_1_AC_0_SB_TL_1.To = 200F; SineEase r_8_s_ET_1_AC_0_SB_TL_1_EA = new SineEase(); r_8_s_ET_1_AC_0_SB_TL_1.EasingFunction = r_8_s_ET_1_AC_0_SB_TL_1_EA; Storyboard.SetTargetProperty(r_8_s_ET_1_AC_0_SB_TL_1, Button.WidthProperty); r_8_s_ET_1_AC_0_SB.Children.Add(r_8_s_ET_1_AC_0_SB_TL_1); this.Add("buttonAnimStyle", r_8_s); // Resource - [Sounds] SoundSourceCollection var r_9_sounds = new SoundSourceCollection(); r_9_sounds.Add(new SoundSource { SoundType = SoundType.ButtonsClick, SoundAsset = "Click" }); SoundManager.Instance.AddSound("Click"); r_9_sounds.Add(new SoundSource { SoundType = SoundType.TextBoxKeyPress, SoundAsset = "KeyPress" }); SoundManager.Instance.AddSound("KeyPress"); r_9_sounds.Add(new SoundSource { SoundType = SoundType.TabControlMove, SoundAsset = "Move" }); SoundManager.Instance.AddSound("Move"); r_9_sounds.Add(new SoundSource { SoundType = SoundType.TabControlSelect, SoundAsset = "Select" }); SoundManager.Instance.AddSound("Select"); this.Add("Sounds", r_9_sounds); // Resource - [TetrisBorderBrush] SolidColorBrush this.Add("TetrisBorderBrush", new SolidColorBrush(new ColorW(114, 176, 218, 255))); // Resource - [DataTemplateKey(GameData.CustomWindow)] DataTemplate Func<UIElement, UIElement> r_11_dtFunc = r_11_dtMethod; this.Add(typeof(GameData.CustomWindow), new DataTemplate(typeof(GameData.CustomWindow), r_11_dtFunc)); ImageManager.Instance.AddImage("Images/MonoGameLogo"); FontManager.Instance.AddFont("Segoe UI", 12F, FontStyle.Regular, "Segoe_UI_9_Regular"); FontManager.Instance.AddFont("Segoe UI", 20F, FontStyle.Bold, "Segoe_UI_15_Bold"); }
private void InitializeResources() { // Resource - [ToolTipText] String this.Add("ToolTipText", "Click to open message box"); // Resource - [TitleResource] String this.Add("TitleResource", "Basic UI Example"); // Resource - [logoSunburn] BitmapImage BitmapImage r_2_bm = new BitmapImage(); r_2_bm.TextureAsset = "Images/SunBurn"; this.Add("logoSunburn", r_2_bm); // Resource - [buttonStyle] Style var r_3_s_bo = this[typeof(Button)]; Style r_3_s = new Style(typeof(Button), r_3_s_bo as Style); Setter r_3_s_S_0 = new Setter(Button.BackgroundProperty, new SolidColorBrush(new ColorW(255, 140, 0, 255))); r_3_s.Setters.Add(r_3_s_S_0); Setter r_3_s_S_1 = new Setter(Button.WidthProperty, 200F); r_3_s.Setters.Add(r_3_s_S_1); Setter r_3_s_S_2 = new Setter(Button.PaddingProperty, new Thickness(2F)); r_3_s.Setters.Add(r_3_s_S_2); this.Add("buttonStyle", r_3_s); // Resource - [logoEmptyKeys] BitmapImage BitmapImage r_4_bm = new BitmapImage(); r_4_bm.TextureAsset = "Images/EmptyKeysLogoTextSmall"; this.Add("logoEmptyKeys", r_4_bm); // Resource - [buttonAnimStyle] Style var r_5_s_bo = this[typeof(Button)]; Style r_5_s = new Style(typeof(Button), r_5_s_bo as Style); Setter r_5_s_S_0 = new Setter(Button.WidthProperty, 200F); r_5_s.Setters.Add(r_5_s_S_0); Setter r_5_s_S_1 = new Setter(Button.MarginProperty, new Thickness(0F, 1F, 0F, 1F)); r_5_s.Setters.Add(r_5_s_S_1); Setter r_5_s_S_2 = new Setter(Button.SnapsToDevicePixelsProperty, false); r_5_s.Setters.Add(r_5_s_S_2); EventTrigger r_5_s_ET_0 = new EventTrigger(Button.MouseEnterEvent); r_5_s.Triggers.Add(r_5_s_ET_0); BeginStoryboard r_5_s_ET_0_AC_0 = new BeginStoryboard(); r_5_s_ET_0_AC_0.Name = "r_5_s_ET_0_AC_0"; r_5_s_ET_0.AddAction(r_5_s_ET_0_AC_0); Storyboard r_5_s_ET_0_AC_0_SB = new Storyboard(); r_5_s_ET_0_AC_0.Storyboard = r_5_s_ET_0_AC_0_SB; r_5_s_ET_0_AC_0_SB.Name = "r_5_s_ET_0_AC_0_SB"; ThicknessAnimation r_5_s_ET_0_AC_0_SB_TL_0 = new ThicknessAnimation(); r_5_s_ET_0_AC_0_SB_TL_0.Name = "r_5_s_ET_0_AC_0_SB_TL_0"; r_5_s_ET_0_AC_0_SB_TL_0.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500)); r_5_s_ET_0_AC_0_SB_TL_0.From = new Thickness(0F, 1F, 0F, 1F); r_5_s_ET_0_AC_0_SB_TL_0.To = new Thickness(0F, 5F, 0F, 5F); SineEase r_5_s_ET_0_AC_0_SB_TL_0_EA = new SineEase(); r_5_s_ET_0_AC_0_SB_TL_0.EasingFunction = r_5_s_ET_0_AC_0_SB_TL_0_EA; Storyboard.SetTargetProperty(r_5_s_ET_0_AC_0_SB_TL_0, Button.MarginProperty); r_5_s_ET_0_AC_0_SB.Children.Add(r_5_s_ET_0_AC_0_SB_TL_0); FloatAnimation r_5_s_ET_0_AC_0_SB_TL_1 = new FloatAnimation(); r_5_s_ET_0_AC_0_SB_TL_1.Name = "r_5_s_ET_0_AC_0_SB_TL_1"; r_5_s_ET_0_AC_0_SB_TL_1.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500)); r_5_s_ET_0_AC_0_SB_TL_1.To = 220F; SineEase r_5_s_ET_0_AC_0_SB_TL_1_EA = new SineEase(); r_5_s_ET_0_AC_0_SB_TL_1.EasingFunction = r_5_s_ET_0_AC_0_SB_TL_1_EA; Storyboard.SetTargetProperty(r_5_s_ET_0_AC_0_SB_TL_1, Button.WidthProperty); r_5_s_ET_0_AC_0_SB.Children.Add(r_5_s_ET_0_AC_0_SB_TL_1); EventTrigger r_5_s_ET_1 = new EventTrigger(Button.MouseLeaveEvent); r_5_s.Triggers.Add(r_5_s_ET_1); BeginStoryboard r_5_s_ET_1_AC_0 = new BeginStoryboard(); r_5_s_ET_1_AC_0.Name = "r_5_s_ET_1_AC_0"; r_5_s_ET_1.AddAction(r_5_s_ET_1_AC_0); Storyboard r_5_s_ET_1_AC_0_SB = new Storyboard(); r_5_s_ET_1_AC_0.Storyboard = r_5_s_ET_1_AC_0_SB; r_5_s_ET_1_AC_0_SB.Name = "r_5_s_ET_1_AC_0_SB"; ThicknessAnimation r_5_s_ET_1_AC_0_SB_TL_0 = new ThicknessAnimation(); r_5_s_ET_1_AC_0_SB_TL_0.Name = "r_5_s_ET_1_AC_0_SB_TL_0"; r_5_s_ET_1_AC_0_SB_TL_0.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500)); r_5_s_ET_1_AC_0_SB_TL_0.From = new Thickness(0F, 5F, 0F, 5F); r_5_s_ET_1_AC_0_SB_TL_0.To = new Thickness(0F, 1F, 0F, 1F); SineEase r_5_s_ET_1_AC_0_SB_TL_0_EA = new SineEase(); r_5_s_ET_1_AC_0_SB_TL_0.EasingFunction = r_5_s_ET_1_AC_0_SB_TL_0_EA; Storyboard.SetTargetProperty(r_5_s_ET_1_AC_0_SB_TL_0, Button.MarginProperty); r_5_s_ET_1_AC_0_SB.Children.Add(r_5_s_ET_1_AC_0_SB_TL_0); FloatAnimation r_5_s_ET_1_AC_0_SB_TL_1 = new FloatAnimation(); r_5_s_ET_1_AC_0_SB_TL_1.Name = "r_5_s_ET_1_AC_0_SB_TL_1"; r_5_s_ET_1_AC_0_SB_TL_1.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500)); r_5_s_ET_1_AC_0_SB_TL_1.To = 200F; SineEase r_5_s_ET_1_AC_0_SB_TL_1_EA = new SineEase(); r_5_s_ET_1_AC_0_SB_TL_1.EasingFunction = r_5_s_ET_1_AC_0_SB_TL_1_EA; Storyboard.SetTargetProperty(r_5_s_ET_1_AC_0_SB_TL_1, Button.WidthProperty); r_5_s_ET_1_AC_0_SB.Children.Add(r_5_s_ET_1_AC_0_SB_TL_1); this.Add("buttonAnimStyle", r_5_s); // Resource - [MessageBoxButtonYes] String this.Add("MessageBoxButtonYes", "Yes!"); // Resource - [Sounds] SoundSourceCollection var r_7_sounds = new SoundSourceCollection(); r_7_sounds.Add(new SoundSource { SoundType = SoundType.ButtonsClick, SoundAsset = "Click" }); SoundManager.Instance.AddSound("Click"); r_7_sounds.Add(new SoundSource { SoundType = SoundType.TextBoxKeyPress, SoundAsset = "KeyPress" }); SoundManager.Instance.AddSound("KeyPress"); r_7_sounds.Add(new SoundSource { SoundType = SoundType.TabControlMove, SoundAsset = "Move" }); SoundManager.Instance.AddSound("Move"); r_7_sounds.Add(new SoundSource { SoundType = SoundType.TabControlSelect, SoundAsset = "Select" }); SoundManager.Instance.AddSound("Select"); this.Add("Sounds", r_7_sounds); ImageManager.Instance.AddImage("Images/SunBurn"); ImageManager.Instance.AddImage("Images/EmptyKeysLogoTextSmall"); FontManager.Instance.AddFont("Segoe UI", 13.33333F, FontStyle.Regular, "Segoe_UI_10_Regular"); FontManager.Instance.AddFont("Segoe UI", 20F, FontStyle.Bold, "Segoe_UI_15_Bold"); FontManager.Instance.AddFont("Segoe UI", 12F, FontStyle.Regular, "Segoe_UI_9_Regular"); }
public OpacityAnimationExample() { // Create a name scope for the page. NameScope.SetNameScope(this, new NameScope()); this.WindowTitle = "Opacity Animation Example"; this.Background = Brushes.White; StackPanel myStackPanel = new StackPanel(); myStackPanel.Margin = new Thickness(20); // // Clicking on this button animates its opacity. // Button opacityAnimatedButton = new Button(); opacityAnimatedButton.Name = "opacityAnimatedButton"; this.RegisterName(opacityAnimatedButton.Name, opacityAnimatedButton); opacityAnimatedButton.Content = "A Button"; myStackPanel.Children.Add(opacityAnimatedButton); // // Create an animation to animate the opacity of a button // DoubleAnimation myOpacityDoubleAnimation = new DoubleAnimation(); Storyboard.SetTargetName(myOpacityDoubleAnimation, opacityAnimatedButton.Name); Storyboard.SetTargetProperty(myOpacityDoubleAnimation, new PropertyPath(Button.OpacityProperty)); myOpacityDoubleAnimation.From = 1; myOpacityDoubleAnimation.To = 0; myOpacityDoubleAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(5000)); myOpacityDoubleAnimation.AutoReverse = true; // // Create a Storyboard to contain the animations and add the animations to the Storyboard // Storyboard myOpacityStoryboard = new Storyboard(); myOpacityStoryboard.Children.Add(myOpacityDoubleAnimation); // // Create EventTriggers and a BeginStoryboard action to start // the storyboard BeginStoryboard myOpacityBeginStoryboard = new BeginStoryboard(); EventTrigger myOpacityEventTrigger = new EventTrigger(); myOpacityEventTrigger.RoutedEvent = Button.ClickEvent; myOpacityEventTrigger.SourceName = opacityAnimatedButton.Name; myStackPanel.Triggers.Add(myOpacityEventTrigger); myOpacityBeginStoryboard.Storyboard = myOpacityStoryboard; myOpacityEventTrigger.Actions.Add(myOpacityBeginStoryboard); // // Clicking on this button animates the opacity of the brush used to paint the background. // Button opacityBrushPaintedButton = new Button(); opacityBrushPaintedButton.Name = "opacityBrushPaintedButton"; this.RegisterName(opacityBrushPaintedButton.Name, opacityBrushPaintedButton); opacityBrushPaintedButton.Content = "A Button"; SolidColorBrush mySolidColorBrush = new SolidColorBrush(); this.RegisterName("mySolidColorBrush", mySolidColorBrush); mySolidColorBrush.Color = Colors.Orange; opacityBrushPaintedButton.Background = mySolidColorBrush; myStackPanel.Children.Add(opacityBrushPaintedButton); // // Create an animation to animate the opacity of the brush used to paint the background of the button. // DoubleAnimation myBackgroundOpacityDoubleAnimation = new DoubleAnimation(); Storyboard.SetTargetName(myBackgroundOpacityDoubleAnimation, "mySolidColorBrush"); Storyboard.SetTargetProperty(myBackgroundOpacityDoubleAnimation, new PropertyPath(Brush.OpacityProperty)); myBackgroundOpacityDoubleAnimation.From = 1; myBackgroundOpacityDoubleAnimation.To = 0; myBackgroundOpacityDoubleAnimation.Duration = new Duration(TimeSpan.FromSeconds(5)); myBackgroundOpacityDoubleAnimation.AutoReverse = true; Storyboard myBackgroundOpacityStoryboard = new Storyboard(); myBackgroundOpacityStoryboard.Children.Add(myBackgroundOpacityDoubleAnimation); // // Create EventTriggers and a BeginStoryboard action to start // the storyboard BeginStoryboard myBackgroundOpacityBeginStoryboard = new BeginStoryboard(); EventTrigger myBackgroundOpacityEventTrigger = new EventTrigger(); myBackgroundOpacityEventTrigger.RoutedEvent = Button.ClickEvent; myBackgroundOpacityEventTrigger.SourceName = opacityBrushPaintedButton.Name; myStackPanel.Triggers.Add(myBackgroundOpacityEventTrigger); myBackgroundOpacityBeginStoryboard.Storyboard = myBackgroundOpacityStoryboard; myBackgroundOpacityEventTrigger.Actions.Add(myBackgroundOpacityBeginStoryboard); this.Content = myStackPanel; }
private void InitializeResources() { // Resource - [HydrogenIcon] BitmapImage BitmapImage r_0_bm = new BitmapImage(); r_0_bm.TextureAsset = "ImagesUI/hydrogen_res"; this.Add("HydrogenIcon", r_0_bm); // Resource - [BiomassIcon] BitmapImage BitmapImage r_1_bm = new BitmapImage(); r_1_bm.TextureAsset = "ImagesUI/biomass_res"; this.Add("BiomassIcon", r_1_bm); // Resource - [CopperIcon] BitmapImage BitmapImage r_2_bm = new BitmapImage(); r_2_bm.TextureAsset = "ImagesUI/copper_res"; this.Add("CopperIcon", r_2_bm); // Resource - [LeadIcon] BitmapImage BitmapImage r_3_bm = new BitmapImage(); r_3_bm.TextureAsset = "ImagesUI/lead_res"; this.Add("LeadIcon", r_3_bm); // Resource - [AluminiumIcon] BitmapImage BitmapImage r_4_bm = new BitmapImage(); r_4_bm.TextureAsset = "ImagesUI/aluminium_res"; this.Add("AluminiumIcon", r_4_bm); // Resource - [NaturalGasIcon] BitmapImage BitmapImage r_5_bm = new BitmapImage(); r_5_bm.TextureAsset = "ImagesUI/gas_res"; this.Add("NaturalGasIcon", r_5_bm); // Resource - [PropaneIcon] BitmapImage BitmapImage r_6_bm = new BitmapImage(); r_6_bm.TextureAsset = "ImagesUI/propane_res"; this.Add("PropaneIcon", r_6_bm); // Resource - [DiamondIcon] BitmapImage BitmapImage r_7_bm = new BitmapImage(); r_7_bm.TextureAsset = "ImagesUI/diamond_res"; this.Add("DiamondIcon", r_7_bm); // Resource - [MonoGameLogo] BitmapImage BitmapImage r_8_bm = new BitmapImage(); r_8_bm.TextureAsset = "Images/MonogameLogo"; this.Add("MonoGameLogo", r_8_bm); // Resource - [MiningIcon] BitmapImage BitmapImage r_9_bm = new BitmapImage(); r_9_bm.TextureAsset = "ImagesUI/mine_build"; this.Add("MiningIcon", r_9_bm); // Resource - [TimberIcon] BitmapImage BitmapImage r_10_bm = new BitmapImage(); r_10_bm.TextureAsset = "ImagesUI/timber_res"; this.Add("TimberIcon", r_10_bm); // Resource - [TitaniumIcon] BitmapImage BitmapImage r_11_bm = new BitmapImage(); r_11_bm.TextureAsset = "ImagesUI/titanium_res"; this.Add("TitaniumIcon", r_11_bm); // Resource - [Building2] BitmapImage BitmapImage r_12_bm = new BitmapImage(); r_12_bm.TextureAsset = "ImagesUI/building2"; this.Add("Building2", r_12_bm); // Resource - [Building1] BitmapImage BitmapImage r_13_bm = new BitmapImage(); r_13_bm.TextureAsset = "ImagesUI/building1"; this.Add("Building1", r_13_bm); // Resource - [Sounds] SoundSourceCollection var r_14_sounds = new SoundSourceCollection(); r_14_sounds.Add(new SoundSource { SoundType = SoundType.ButtonsClick, SoundAsset = "Click" }); SoundManager.Instance.AddSound("Click"); r_14_sounds.Add(new SoundSource { SoundType = SoundType.TextBoxKeyPress, SoundAsset = "KeyPress" }); SoundManager.Instance.AddSound("KeyPress"); r_14_sounds.Add(new SoundSource { SoundType = SoundType.TabControlMove, SoundAsset = "Move" }); SoundManager.Instance.AddSound("Move"); r_14_sounds.Add(new SoundSource { SoundType = SoundType.TabControlSelect, SoundAsset = "Select" }); SoundManager.Instance.AddSound("Select"); this.Add("Sounds", r_14_sounds); // Resource - [buttonAnimStyle] Style var r_15_s_bo = this[typeof(Button)]; Style r_15_s = new Style(typeof(Button), r_15_s_bo as Style); Setter r_15_s_S_0 = new Setter(Button.WidthProperty, 200F); r_15_s.Setters.Add(r_15_s_S_0); Setter r_15_s_S_1 = new Setter(Button.MarginProperty, new Thickness(0F, 1F, 0F, 1F)); r_15_s.Setters.Add(r_15_s_S_1); Setter r_15_s_S_2 = new Setter(Button.SnapsToDevicePixelsProperty, false); r_15_s.Setters.Add(r_15_s_S_2); EventTrigger r_15_s_ET_0 = new EventTrigger(Button.MouseEnterEvent); r_15_s.Triggers.Add(r_15_s_ET_0); BeginStoryboard r_15_s_ET_0_AC_0 = new BeginStoryboard(); r_15_s_ET_0_AC_0.Name = "r_15_s_ET_0_AC_0"; r_15_s_ET_0.AddAction(r_15_s_ET_0_AC_0); Storyboard r_15_s_ET_0_AC_0_SB = new Storyboard(); r_15_s_ET_0_AC_0.Storyboard = r_15_s_ET_0_AC_0_SB; r_15_s_ET_0_AC_0_SB.Name = "r_15_s_ET_0_AC_0_SB"; ThicknessAnimation r_15_s_ET_0_AC_0_SB_TL_0 = new ThicknessAnimation(); r_15_s_ET_0_AC_0_SB_TL_0.Name = "r_15_s_ET_0_AC_0_SB_TL_0"; r_15_s_ET_0_AC_0_SB_TL_0.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500)); r_15_s_ET_0_AC_0_SB_TL_0.From = new Thickness(0F, 1F, 0F, 1F); r_15_s_ET_0_AC_0_SB_TL_0.To = new Thickness(0F, 5F, 0F, 5F); SineEase r_15_s_ET_0_AC_0_SB_TL_0_EA = new SineEase(); r_15_s_ET_0_AC_0_SB_TL_0.EasingFunction = r_15_s_ET_0_AC_0_SB_TL_0_EA; Storyboard.SetTargetProperty(r_15_s_ET_0_AC_0_SB_TL_0, Button.MarginProperty); r_15_s_ET_0_AC_0_SB.Children.Add(r_15_s_ET_0_AC_0_SB_TL_0); FloatAnimation r_15_s_ET_0_AC_0_SB_TL_1 = new FloatAnimation(); r_15_s_ET_0_AC_0_SB_TL_1.Name = "r_15_s_ET_0_AC_0_SB_TL_1"; r_15_s_ET_0_AC_0_SB_TL_1.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500)); r_15_s_ET_0_AC_0_SB_TL_1.To = 220F; SineEase r_15_s_ET_0_AC_0_SB_TL_1_EA = new SineEase(); r_15_s_ET_0_AC_0_SB_TL_1.EasingFunction = r_15_s_ET_0_AC_0_SB_TL_1_EA; Storyboard.SetTargetProperty(r_15_s_ET_0_AC_0_SB_TL_1, Button.WidthProperty); r_15_s_ET_0_AC_0_SB.Children.Add(r_15_s_ET_0_AC_0_SB_TL_1); EventTrigger r_15_s_ET_1 = new EventTrigger(Button.MouseLeaveEvent); r_15_s.Triggers.Add(r_15_s_ET_1); BeginStoryboard r_15_s_ET_1_AC_0 = new BeginStoryboard(); r_15_s_ET_1_AC_0.Name = "r_15_s_ET_1_AC_0"; r_15_s_ET_1.AddAction(r_15_s_ET_1_AC_0); Storyboard r_15_s_ET_1_AC_0_SB = new Storyboard(); r_15_s_ET_1_AC_0.Storyboard = r_15_s_ET_1_AC_0_SB; r_15_s_ET_1_AC_0_SB.Name = "r_15_s_ET_1_AC_0_SB"; ThicknessAnimation r_15_s_ET_1_AC_0_SB_TL_0 = new ThicknessAnimation(); r_15_s_ET_1_AC_0_SB_TL_0.Name = "r_15_s_ET_1_AC_0_SB_TL_0"; r_15_s_ET_1_AC_0_SB_TL_0.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500)); r_15_s_ET_1_AC_0_SB_TL_0.From = new Thickness(0F, 5F, 0F, 5F); r_15_s_ET_1_AC_0_SB_TL_0.To = new Thickness(0F, 1F, 0F, 1F); SineEase r_15_s_ET_1_AC_0_SB_TL_0_EA = new SineEase(); r_15_s_ET_1_AC_0_SB_TL_0.EasingFunction = r_15_s_ET_1_AC_0_SB_TL_0_EA; Storyboard.SetTargetProperty(r_15_s_ET_1_AC_0_SB_TL_0, Button.MarginProperty); r_15_s_ET_1_AC_0_SB.Children.Add(r_15_s_ET_1_AC_0_SB_TL_0); FloatAnimation r_15_s_ET_1_AC_0_SB_TL_1 = new FloatAnimation(); r_15_s_ET_1_AC_0_SB_TL_1.Name = "r_15_s_ET_1_AC_0_SB_TL_1"; r_15_s_ET_1_AC_0_SB_TL_1.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500)); r_15_s_ET_1_AC_0_SB_TL_1.To = 200F; SineEase r_15_s_ET_1_AC_0_SB_TL_1_EA = new SineEase(); r_15_s_ET_1_AC_0_SB_TL_1.EasingFunction = r_15_s_ET_1_AC_0_SB_TL_1_EA; Storyboard.SetTargetProperty(r_15_s_ET_1_AC_0_SB_TL_1, Button.WidthProperty); r_15_s_ET_1_AC_0_SB.Children.Add(r_15_s_ET_1_AC_0_SB_TL_1); this.Add("buttonAnimStyle", r_15_s); // Resource - [ZincIcon] BitmapImage BitmapImage r_16_bm = new BitmapImage(); r_16_bm.TextureAsset = "ImagesUI/zinc_res"; this.Add("ZincIcon", r_16_bm); // Resource - [SunBurnLogo] BitmapImage BitmapImage r_17_bm = new BitmapImage(); r_17_bm.TextureAsset = "Images/SunBurn"; this.Add("SunBurnLogo", r_17_bm); // Resource - [buttonStyle] Style var r_18_s_bo = this[typeof(Button)]; Style r_18_s = new Style(typeof(Button), r_18_s_bo as Style); Setter r_18_s_S_0 = new Setter(Button.BackgroundProperty, new SolidColorBrush(new ColorW(255, 140, 0, 255))); r_18_s.Setters.Add(r_18_s_S_0); this.Add("buttonStyle", r_18_s); // Resource - [GoldIcon] BitmapImage BitmapImage r_19_bm = new BitmapImage(); r_19_bm.TextureAsset = "ImagesUI/gold_res"; this.Add("GoldIcon", r_19_bm); // Resource - [IronIcon] BitmapImage BitmapImage r_20_bm = new BitmapImage(); r_20_bm.TextureAsset = "ImagesUI/iron_res"; this.Add("IronIcon", r_20_bm); // Resource - [CoalIcon] BitmapImage BitmapImage r_21_bm = new BitmapImage(); r_21_bm.TextureAsset = "ImagesUI/coal_res"; this.Add("CoalIcon", r_21_bm); // Resource - [OilIcon] BitmapImage BitmapImage r_22_bm = new BitmapImage(); r_22_bm.TextureAsset = "ImagesUI/oil_res"; this.Add("OilIcon", r_22_bm); // Resource - [ThoriumIcon] BitmapImage BitmapImage r_23_bm = new BitmapImage(); r_23_bm.TextureAsset = "ImagesUI/thorium_res"; this.Add("ThoriumIcon", r_23_bm); // Resource - [UraniumIcon] BitmapImage BitmapImage r_24_bm = new BitmapImage(); r_24_bm.TextureAsset = "ImagesUI/uranium_res"; this.Add("UraniumIcon", r_24_bm); // Resource - [SilverIcon] BitmapImage BitmapImage r_25_bm = new BitmapImage(); r_25_bm.TextureAsset = "ImagesUI/silver_res"; this.Add("SilverIcon", r_25_bm); // Resource - [MagnesiumIcon] BitmapImage BitmapImage r_26_bm = new BitmapImage(); r_26_bm.TextureAsset = "ImagesUI/magnesium_res"; this.Add("MagnesiumIcon", r_26_bm); // Resource - [LivestockIcon] BitmapImage BitmapImage r_27_bm = new BitmapImage(); r_27_bm.TextureAsset = "ImagesUI/livestock_res"; this.Add("LivestockIcon", r_27_bm); // Resource - [WaterIcon] BitmapImage BitmapImage r_28_bm = new BitmapImage(); r_28_bm.TextureAsset = "ImagesUI/water_res"; this.Add("WaterIcon", r_28_bm); // Resource - [PlatinumIcon] BitmapImage BitmapImage r_29_bm = new BitmapImage(); r_29_bm.TextureAsset = "ImagesUI/platinum_res"; this.Add("PlatinumIcon", r_29_bm); ImageManager.Instance.AddImage("ImagesUI/hydrogen_res"); ImageManager.Instance.AddImage("ImagesUI/biomass_res"); ImageManager.Instance.AddImage("ImagesUI/copper_res"); ImageManager.Instance.AddImage("ImagesUI/lead_res"); ImageManager.Instance.AddImage("ImagesUI/aluminium_res"); ImageManager.Instance.AddImage("ImagesUI/gas_res"); ImageManager.Instance.AddImage("ImagesUI/propane_res"); ImageManager.Instance.AddImage("ImagesUI/diamond_res"); ImageManager.Instance.AddImage("Images/MonogameLogo"); ImageManager.Instance.AddImage("ImagesUI/mine_build"); ImageManager.Instance.AddImage("ImagesUI/timber_res"); ImageManager.Instance.AddImage("ImagesUI/titanium_res"); ImageManager.Instance.AddImage("ImagesUI/building2"); ImageManager.Instance.AddImage("ImagesUI/building1"); ImageManager.Instance.AddImage("ImagesUI/zinc_res"); ImageManager.Instance.AddImage("Images/SunBurn"); ImageManager.Instance.AddImage("ImagesUI/gold_res"); ImageManager.Instance.AddImage("ImagesUI/iron_res"); ImageManager.Instance.AddImage("ImagesUI/coal_res"); ImageManager.Instance.AddImage("ImagesUI/oil_res"); ImageManager.Instance.AddImage("ImagesUI/thorium_res"); ImageManager.Instance.AddImage("ImagesUI/uranium_res"); ImageManager.Instance.AddImage("ImagesUI/silver_res"); ImageManager.Instance.AddImage("ImagesUI/magnesium_res"); ImageManager.Instance.AddImage("ImagesUI/livestock_res"); ImageManager.Instance.AddImage("ImagesUI/water_res"); ImageManager.Instance.AddImage("ImagesUI/platinum_res"); }