In den meisten Fällen definieren Sie eine Storyboardanimation, indem Sie XAML-Code schreiben.
Most of the time, you define a storyboarded animation by writing XAML.
Das erste, was wir dafür benötigen, um unsere Oberfläche zu gestalten, ist etwas XAML-Code.
The first thing we need is some XAML to define our user interface.
Der Hauptunterschied besteht darin, dass eine statische Ressource nur einmal aufgelöst wird, und zwar an dem Punkt, an dem der XAML-Code geladen wird.
The main difference is that a static resource is resolved only once, which is at the point where the XAML is loaded.
Verweisen Sie im XAML-Code mithilfe des Ressourcenbezeichners und der Eigenschaft auf die Zeichenfolgenressource
In your XAML, refer to the string resource using the resource identifier and the property
Bis jetzt haben wir alle unsere Ressourcen direkt vom XAML-Code über eine Markup-Erweiterung aufgerufen.
So far, we've accessed all of our resources directly from XAML, using a markup extension.
Storyboards werden normalerweise in XAML-Code definiert, der sich nicht in unmittelbarer Nähe der XAML-UI-Definition des zu animierenden Objekts befindet.
Storyboards are usually defined in XAML that's not in the immediately vicinity of the XAML UI definition of the object to animate.
Außerdem habe ich Klickergebnisse zum XAML-Code hinzugefügt und das Erstellen von Ereignishandlern in Visual Studio eingerichtet.
I also added click events to the XAML and allowed Visual Studio to generate the event handlers.
Der XAML-Code veranschaulicht außerdem Visual State Setter, die neu für die UAP sind und mit denen Sie einen separaten Eigenschaftswert ohne den Aufwand einer Storyboard-Animation festlegen können.
The XAML also demonstrates Visual State Setters, which are new in the UAP and let you set a discrete property value without the overhead of a storyboard animation.
Wenn in Blend 2 Objekte auf der Arbeitsfläche in der Designansicht oder im Bereich „Objects and Timeline" ausgewählt werden, springt der Cursor im XAML-Editor direkt an die entsprechende Stelle im XAML-Code.
Additionally, when you select an object, on the artboard in Design view or under Objects and Timeline, the cursor in XAML view immediately moves to the corresponding line of XAML.
Wenn Sie ein Tool wie Microsoft Visual Studio verwenden, können Sie den XAML-Code vom Tool erzeugen lassen.
If you use a tool such as Microsoft Visual Studio, it will produce the XAML for you.
Nutzen Sie adaptive Auslöser im XAML-Code, um anzugeben, wie Steuerelemente angezeigt werden sollen (beispielsweise in Abhängigkeit von der Geräteausrichtung).
Use adaptive triggers in your XAML to specify how controls should appear based on things like the orientation of the device.
Der XAML-Code der Anwendung sollte nun wie der Code in Abbildung 3 aussehen.
The application bar XAML should now look like the code in Figure 3.
Im vorigen Artikel haben wir ein ListView-Steuerelement manuell mit XAML-Code gefüllt, aber in WPF dreht sich ja alles um die Datenbindung.
In the previous article, we manually populated a ListView control through XAML code, but in WPF, it's all about data binding.