Frage

Ich suche XAML, das ein Ladesymbol darstellt, wie es Vista tut.

Visuelle Beschreibung:

  • Rund (ca. 1/3 Zoll breit)
  • Hellere blaue Farbe
  • transparentes Zentrum
  • Gelknopf schauen (abgerundete Kanten wtih ein kleiner Schatten)
  • weißer Spinner um die Kante, um die Bewegung zu geben

Leichte (er) Himmelblau / Gelpack aussahen

Ich habe rechteckige Rechtecke gefunden, und wir können XAML erstellen, die die Illusion des Spinnens verleihen, aber wir zeichnen nur 12 Teile einer Uhr und zeichnen jeden einzeln an.

War es hilfreich?

Lösung

Hier ist ein super einfacher Spinner, den ich in SL erstellt habe, den Sie in WPF konvertieren können.

<UserControl x:Class="Spinner.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Width="400" Height="300">
    <UserControl.Resources>
        <Storyboard x:Name="Animiation" RepeatBehavior="Forever">
            <DoubleAnimation To=".5" AutoReverse="True" BeginTime="0:0:0"  Duration="0:0:.25" Storyboard.TargetName="e1" Storyboard.TargetProperty="Opacity"/>
            <DoubleAnimation To=".5" AutoReverse="True" BeginTime="0:0:0.125"  Duration="0:0:.25" Storyboard.TargetName="e2" Storyboard.TargetProperty="Opacity"/>
            <DoubleAnimation To=".5" AutoReverse="True" BeginTime="0:0:0.25"  Duration="0:0:.25" Storyboard.TargetName="e3" Storyboard.TargetProperty="Opacity"/>
            <DoubleAnimation To=".5" AutoReverse="True" BeginTime="0:0:0.375"  Duration="0:0:.25" Storyboard.TargetName="e4" Storyboard.TargetProperty="Opacity"/>
            <DoubleAnimation To=".5" AutoReverse="True" BeginTime="0:0:0.5"  Duration="0:0:.25" Storyboard.TargetName="e5" Storyboard.TargetProperty="Opacity"/>
            <DoubleAnimation To=".5" AutoReverse="True" BeginTime="0:0:0.625"  Duration="0:0:.25" Storyboard.TargetName="e6" Storyboard.TargetProperty="Opacity"/>
            <DoubleAnimation To=".5" AutoReverse="True" BeginTime="0:0:0.75"  Duration="0:0:.25" Storyboard.TargetName="e7" Storyboard.TargetProperty="Opacity"/>
            <DoubleAnimation To=".5" AutoReverse="True" BeginTime="0:0:0.825"  Duration="0:0:.25" Storyboard.TargetName="e8" Storyboard.TargetProperty="Opacity"/>
        </Storyboard>
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot" Background="White">
        <Grid Width="100" Height="100" x:Name="gridSpinner">
            <Ellipse x:Name="e1" Margin="40,80,0,0" Height="20" Width="20" Fill="Gray" Stretch="Fill" VerticalAlignment="Top" HorizontalAlignment="Left"/>
            <Ellipse x:Name="e2" Margin="12,68,0,0" Height="20" Width="20" Fill="Gray" Stretch="Fill" VerticalAlignment="Top" HorizontalAlignment="Left"/>
            <Ellipse x:Name="e3" Margin="0,40,0,0" Height="20" Width="20" Fill="Gray" Stretch="Fill" VerticalAlignment="Top" HorizontalAlignment="Left"/>
            <Ellipse x:Name="e4" Margin="12,12,0,0" Height="20" Width="20" Fill="Gray" Stretch="Fill" VerticalAlignment="Top" HorizontalAlignment="Left"/>
            <Ellipse x:Name="e5" Margin="40,0,0,0" Height="20" Width="20" Fill="Gray" Stretch="Fill" VerticalAlignment="Top" HorizontalAlignment="Left"/>
            <Ellipse x:Name="e6" Margin="68,12,0,0" Height="20" Width="20" Fill="Gray" Stretch="Fill" VerticalAlignment="Top" HorizontalAlignment="Left"/>
            <Ellipse x:Name="e7" Margin="80,40,0,0" Height="20" Width="20" Fill="Gray" Stretch="Fill" VerticalAlignment="Top" HorizontalAlignment="Left"/>
            <Ellipse x:Name="e8" Margin="68,68,0,0" Height="20" Width="20" Fill="Gray" Stretch="Fill" VerticalAlignment="Top" HorizontalAlignment="Left"/>
      </Grid>
    </Grid>
</UserControl>

Andere Tipps

Muss es unbedingt Voll-Xaml sein? Für diese Art von Effekten funktionieren transparente PNGs einfach großartig. Stapeln Sie einfach die PNGs in einem Gitter und animieren Sie einige von ihnen mit Rotatetransform und Doubleanimation.

Wenn Ihre Bewerbung nicht viel zoomen muss, ist dies der einfachste Weg, um den Trick zu tun.

Grüße, Laurent

@Joeln, danke, ich konnte dies in WPF konvertieren und bekommen, was ich brauchte, danke.

<Page   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Page.Triggers>
<EventTrigger RoutedEvent="Page.Loaded">
    <BeginStoryboard Name="beginThis">
        <Storyboard x:Name="Animiation" RepeatBehavior="Forever">
            <DoubleAnimation To=".5" AutoReverse="True" BeginTime="0:0:0"  Duration="0:0:.25" Storyboard.TargetName="e1" Storyboard.TargetProperty="Opacity"/>
            <DoubleAnimation To=".5" AutoReverse="True" BeginTime="0:0:0.125"  Duration="0:0:.25" Storyboard.TargetName="e2" Storyboard.TargetProperty="Opacity"/>
            <DoubleAnimation To=".5" AutoReverse="True" BeginTime="0:0:0.25"  Duration="0:0:.25" Storyboard.TargetName="e3" Storyboard.TargetProperty="Opacity"/>
            <DoubleAnimation To=".5" AutoReverse="True" BeginTime="0:0:0.375"  Duration="0:0:.25" Storyboard.TargetName="e4" Storyboard.TargetProperty="Opacity"/>
            <DoubleAnimation To=".5" AutoReverse="True" BeginTime="0:0:0.5"  Duration="0:0:.25" Storyboard.TargetName="e5" Storyboard.TargetProperty="Opacity"/>
            <DoubleAnimation To=".5" AutoReverse="True" BeginTime="0:0:0.625"  Duration="0:0:.25" Storyboard.TargetName="e6" Storyboard.TargetProperty="Opacity"/>
            <DoubleAnimation To=".5" AutoReverse="True" BeginTime="0:0:0.75"  Duration="0:0:.25" Storyboard.TargetName="e7" Storyboard.TargetProperty="Opacity"/>
            <DoubleAnimation To=".5" AutoReverse="True" BeginTime="0:0:0.825"  Duration="0:0:.25" Storyboard.TargetName="e8" Storyboard.TargetProperty="Opacity"/>
        </Storyboard>
    </BeginStoryboard>
</EventTrigger>
</Page.Triggers>
    <Grid x:Name="LayoutRoot" Background="White">
        <Grid Width="100" Height="100" x:Name="gridSpinner">
            <Ellipse x:Name="e1" Margin="40,80,0,0" Height="20" Width="20" Fill="Gray" Stretch="Fill" VerticalAlignment="Top" HorizontalAlignment="Left"/>
            <Ellipse x:Name="e2" Margin="12,68,0,0" Height="20" Width="20" Fill="Gray" Stretch="Fill" VerticalAlignment="Top" HorizontalAlignment="Left"/>
            <Ellipse x:Name="e3" Margin="0,40,0,0" Height="20" Width="20" Fill="Gray" Stretch="Fill" VerticalAlignment="Top" HorizontalAlignment="Left"/>
            <Ellipse x:Name="e4" Margin="12,12,0,0" Height="20" Width="20" Fill="Gray" Stretch="Fill" VerticalAlignment="Top" HorizontalAlignment="Left"/>
            <Ellipse x:Name="e5" Margin="40,0,0,0" Height="20" Width="20" Fill="Gray" Stretch="Fill" VerticalAlignment="Top" HorizontalAlignment="Left"/>
            <Ellipse x:Name="e6" Margin="68,12,0,0" Height="20" Width="20" Fill="Gray" Stretch="Fill" VerticalAlignment="Top" HorizontalAlignment="Left"/>
            <Ellipse x:Name="e7" Margin="80,40,0,0" Height="20" Width="20" Fill="Gray" Stretch="Fill" VerticalAlignment="Top" HorizontalAlignment="Left"/>
            <Ellipse x:Name="e8" Margin="68,68,0,0" Height="20" Width="20" Fill="Gray" Stretch="Fill" VerticalAlignment="Top" HorizontalAlignment="Left"/>
      </Grid>
    </Grid>

</Page>
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top