Skip to content

Instantly share code, notes, and snippets.

/loadingbar.xaml Secret

Created February 22, 2017 14:59
Show Gist options
  • Save anonymous/0ed9b04ebcddac2cd0ed11bc7b256af8 to your computer and use it in GitHub Desktop.
Save anonymous/0ed9b04ebcddac2cd0ed11bc7b256af8 to your computer and use it in GitHub Desktop.
<Window x:Class="WPFTestApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WPFTestApp"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<Window.Resources>
<Color x:Key="backgroundcolor" R="00" G="00" B="00" />
<Color x:Key="foregroundcolor" R="0xFF" G="0xFF" B="0xFF" />
<LinearGradientBrush x:Key="gradientBrush">
<GradientStop x:Name="Stop1" Color="{StaticResource backgroundcolor}" Offset="-.4" />
<GradientStop x:Name="Stop8" Color="{StaticResource foregroundcolor}" Offset=".3" />
<GradientStop x:Name="Stop17" Color="{StaticResource backgroundcolor}" Offset="1.2" />
</LinearGradientBrush>
<Style x:Key="stripes" TargetType="Border">
<Style.Triggers>
<EventTrigger RoutedEvent="Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetProperty="gradientBrush.(GradientBrush.GradientStops)[1].(GradientStop.Offset)"
By=".2" Duration="0:0:1"
RepeatBehavior="Forever"
/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Style.Triggers>
</Style>
</Window.Resources>
<Grid Name="root">
<Border BorderThickness="2" BorderBrush="Gray" Height="20" Width="150" Style="{StaticResource stripes}" />
</Grid>
</Window>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment