WPF -- Animation Question - wpf

New to WPF. Simple scenario. Can't figure out the right way to do this.
Say I have a single Button. I also have four TextBlocks. I want that one button to trigger an animation (Opacity from 0 to 1) on all of the TextBlocks at the same time.
Thanks in advance!

This should do it...
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="WpfApplication1.MainWindow"
x:Name="Window"
Title="MainWindow"
Width="640" Height="480">
<Window.Resources>
<Storyboard x:Key="OnClick1">
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="textBlock" Storyboard.TargetProperty="(UIElement.Opacity)">
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
<SplineDoubleKeyFrame KeyTime="00:00:00.5000000" Value="1"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="textBlock1" Storyboard.TargetProperty="(UIElement.Opacity)">
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
<SplineDoubleKeyFrame KeyTime="00:00:00.5000000" Value="1"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="textBlock2" Storyboard.TargetProperty="(UIElement.Opacity)">
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
<SplineDoubleKeyFrame KeyTime="00:00:00.5000000" Value="1"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="textBlock3" Storyboard.TargetProperty="(UIElement.Opacity)">
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
<SplineDoubleKeyFrame KeyTime="00:00:00.5000000" Value="1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</Window.Resources>
<Window.Triggers>
<EventTrigger RoutedEvent="ButtonBase.Click" SourceName="button">
<BeginStoryboard Storyboard="{StaticResource OnClick1}"/>
</EventTrigger>
</Window.Triggers>
<Grid x:Name="LayoutRoot">
<StackPanel>
<Button x:Name="button" Width="131" Height="37" Content="Button" Margin="0,0,0,22"/>
<TextBlock x:Name="textBlock" Height="27" Text="TextBlock 1" TextWrapping="Wrap" Opacity="0"/>
<TextBlock x:Name="textBlock1" Height="27" Text="TextBlock 2" TextWrapping="Wrap" Opacity="0"/>
<TextBlock x:Name="textBlock2" Height="27" Text="TextBlock 3" TextWrapping="Wrap" Opacity="0"/>
<TextBlock x:Name="textBlock3" Height="27" Text="TextBlock 4" TextWrapping="Wrap" Opacity="0"/>
</StackPanel>
</Grid>
</Window>

Related

how to use element's of a page in other page in WPF

In my MainWindow.xaml is a data grid view and i x:name it "MyList".
System.InvalidOperationException: ''MyList' name cannot be found in
the name scope of 'System.Windows.Controls.Button'.'
Guide me how i name my data grid to able to access it in other pages or how i reference or scope MainWindow.xaml to other pages / usercontrols
Edit:
this is my data grid Named MyList and it is in MainWindow : ```
VerticalGridLinesBrush="White"
BorderThickness="1"
CanUserResizeColumns="False"
CanUserResizeRows="False"
ClipboardCopyMode="IncludeHeader"
AllowDrop="True"
SelectionMode="Extended"
Foreground="#FF434343"
AlternatingRowBackground="#FFEFF0DD"
CanUserAddRows="False" Background="White" RenderTransformOrigin="0.5,0.5" BorderBrush="{x:Null}"
>
<DataGrid.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</DataGrid.RenderTransform>
<DataGrid.Columns>
<DataGridTextColumn Header="ردیف" Width="75" FontSize="16" Binding="{Binding Path=id}" IsReadOnly="True" ></DataGridTextColumn>
<DataGridTextColumn Header="نام" Width="200" FontSize="16" Binding="{Binding Path=name}" IsReadOnly="True"></DataGridTextColumn>
<DataGridTextColumn Header="تعداد" Width="auto" FontSize="16" Binding="{Binding Path=tedad}" IsReadOnly="True"></DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>```
now here is app.xaml and i need to reference mainwindow to here but i dont know how t add it in xaml :```
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<!--#region User Control Add-->
<!--#region Anime Open Add-->
<Storyboard x:Key="anmOpenAdd">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="AddPage">
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="-350"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="-350"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="-320"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<!--#endregion-->
<!--#region Anime Close Add-->
<Storyboard x:Key="anmCloseAdd">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="AddPage">
<EasingDoubleKeyFrame KeyTime="0" Value="-320"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="-350"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="20"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<!--#endregion-->
<!--#endregion-->
<!--#region Edit User Control-->
<!--#region Edit Open Up-->
<Storyboard x:Key="anmEditOpen">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="EditPage">
<EasingDoubleKeyFrame KeyTime="0" Value="-320"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="anmMyListEditOpen">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="MyList">
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="320"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<!--#endregion-->
<!--#region Edit Close Up-->
<Storyboard x:Key="anmEditClose">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="EditPage">
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="-340"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="anmMyListEditClose">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="{Binding ElementName=MyList}">
<EasingDoubleKeyFrame KeyTime="0" Value="320"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<!--#endregion-->
<!--#endregion-->
<!--#region Resource Disctionary-->
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Grey.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml" />
</ResourceDictionary.MergedDictionaries>
<!--#endregion-->
</ResourceDictionary>

Animated UserControl : StoryBoard not starting?

I'm trying to create an animation in one of my apps.
The animation is a Control that has a StoryBoard defined in its Resources and starts this StoryBoard after it's been loaded. Here's the (somewhat stripped) XAML:
<UserControl x:Class="LernInsel.Resources.Assets.Water" x:Name="UserControl">
<UserControl.Resources>
<Storyboard x:Key="BaseAnimation" x:Name="BaseAnimation" RepeatBehavior="Forever">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="waveLeft">
<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:1.3" Value="0.45"/>
<EasingDoubleKeyFrame KeyTime="0:0:2.3" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="waveRight">
<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:1.3" Value="0.45"/>
<EasingDoubleKeyFrame KeyTime="0:0:2.3" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="waveLeft_Copy">
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:1" Value="0.39"/>
<EasingDoubleKeyFrame KeyTime="0:0:2" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="waveRight_Copy">
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:1" Value="0.39"/>
<EasingDoubleKeyFrame KeyTime="0:0:2" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="waveLeft_Copy1">
<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:1.5" Value="0.41"/>
<EasingDoubleKeyFrame KeyTime="0:0:2.5" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="waveRight_Copy1">
<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:1.5" Value="0.41"/>
<EasingDoubleKeyFrame KeyTime="0:0:2.5" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="waveLeft_Copy2">
<EasingDoubleKeyFrame KeyTime="0:0:0.9" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:1.9" Value="0.35"/>
<EasingDoubleKeyFrame KeyTime="0:0:2.9" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="waveRight_Copy2">
<EasingDoubleKeyFrame KeyTime="0:0:0.9" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:1.9" Value="0.35"/>
<EasingDoubleKeyFrame KeyTime="0:0:2.9" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</UserControl.Resources>
<UserControl.Triggers>
<EventTrigger RoutedEvent="FrameworkElement.Loaded">
<BeginStoryboard Storyboard="{StaticResource BaseAnimation}"/>
</EventTrigger>
</UserControl.Triggers>
<Grid>
<Rectangle x:Name="Background" Fill="#FF0B5FBC" Height="88" VerticalAlignment="Top"/>
<Rectangle x:Name="waveLeft" Fill="{DynamicResource ResourceKey=waveBright}" Height="60" Margin="25.5,6,286.5,0" VerticalAlignment="Top" Opacity="0" RenderTransformOrigin="0.5,0.5"/>
<Rectangle x:Name="waveRight" Fill="{DynamicResource ResourceKey=waveBright}" Height="60" Margin="308.5,6,3.5,0" VerticalAlignment="Top" Opacity="0" RenderTransformOrigin="0.5,0.5"/>
<Rectangle x:Name="waveLeft_Copy" Fill="{DynamicResource ResourceKey=waveBright}" Height="60" Margin="-3.5,15,315.5,0" VerticalAlignment="Top" Opacity="0" RenderTransformOrigin="0.5,0.5"/>
<Rectangle x:Name="waveRight_Copy" Fill="{DynamicResource ResourceKey=waveBright}" Height="60" Margin="279.5,15,32.5,0" VerticalAlignment="Top" Opacity="0" RenderTransformOrigin="0.5,0.5"/>
<Rectangle x:Name="waveLeft_Copy1" Fill="{DynamicResource ResourceKey=waveBright}" Height="60" Margin="45.5,25,266.5,0" VerticalAlignment="Top" Opacity="0" RenderTransformOrigin="0.5,0.5"/>
<Rectangle x:Name="waveRight_Copy1" Fill="{DynamicResource ResourceKey=waveBright}" Height="60" Margin="0,25,-16.5,0" VerticalAlignment="Top" Opacity="0" RenderTransformOrigin="0.5,0.5"/>
<Rectangle x:Name="waveLeft_Copy2" Fill="{DynamicResource ResourceKey=waveBright}" Height="60" Margin="-3.5,38,315.5,0" VerticalAlignment="Top" Opacity="0" RenderTransformOrigin="0.5,0.5"/>
<Rectangle x:Name="waveRight_Copy2" Fill="{DynamicResource ResourceKey=waveBright}" Height="60" Margin="279.5,38,32.5,0" VerticalAlignment="Top" Opacity="0" RenderTransformOrigin="0.5,0.5"/>
</Grid>
</UserControl>
When I create an instance of this on my Window, this looks fine in the designer, even the animation is being displayed. At Runtime, the Control is displayed as a unicolor Box (background color), but the animation never starts. Do you see anything wrong with the way Blend created the Trigger that might keep it from working?
Thanks a lot in advance!
Sebi
Cannot reproduce this, given that waveBright is actually defined in a reachable scope of your UserControl. This might be the only weakness of that code.

Custom Splash screen Silverlight issue

I created a simple splash screen using Blend and then copied the contents to Splash.xaml in my Web project. This is the xaml :-
<Grid 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:ed="http://schemas.microsoft.com/expression/2010/drawing"
d:DesignHeight="600" d:DesignWidth="800" mc:Ignorable="d">
<Grid.Resources>
<Storyboard x:Name="SplashStoryboard" RepeatBehavior="Forever" AutoReverse="True">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Arc.StartAngle)" Storyboard.TargetName="arc">
<EasingDoubleKeyFrame KeyTime="0:0:1.6" Value="90"/>
<EasingDoubleKeyFrame KeyTime="0:0:3.5" Value="180"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Arc.EndAngle)" Storyboard.TargetName="arc">
<EasingDoubleKeyFrame KeyTime="0:0:1.6" Value="180"/>
<EasingDoubleKeyFrame KeyTime="0:0:3.5" Value="270"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Arc.StartAngle)" Storyboard.TargetName="arc1">
<EasingDoubleKeyFrame KeyTime="0:0:1.6" Value="180"/>
<EasingDoubleKeyFrame KeyTime="0:0:3.5" Value="270"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Arc.EndAngle)" Storyboard.TargetName="arc1">
<EasingDoubleKeyFrame KeyTime="0:0:1.6" Value="270"/>
<EasingDoubleKeyFrame KeyTime="0:0:3.5" Value="360"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Arc.StartAngle)" Storyboard.TargetName="arc2">
<EasingDoubleKeyFrame KeyTime="0:0:1.6" Value="270"/>
<EasingDoubleKeyFrame KeyTime="0:0:3.5" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Arc.EndAngle)" Storyboard.TargetName="arc2">
<EasingDoubleKeyFrame KeyTime="0:0:1.6" Value="360"/>
<EasingDoubleKeyFrame KeyTime="0:0:3.5" Value="90"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Arc.StartAngle)" Storyboard.TargetName="arc3">
<EasingDoubleKeyFrame KeyTime="0:0:1.6" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:3.5" Value="90"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Arc.EndAngle)" Storyboard.TargetName="arc3">
<EasingDoubleKeyFrame KeyTime="0:0:1.6" Value="90"/>
<EasingDoubleKeyFrame KeyTime="0:0:3.5" Value="180"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Arc.StartAngle)" Storyboard.TargetName="arc4">
<EasingDoubleKeyFrame KeyTime="0:0:1.6" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:3.5" Value="90"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Arc.EndAngle)" Storyboard.TargetName="arc4">
<EasingDoubleKeyFrame KeyTime="0:0:1.6" Value="90"/>
<EasingDoubleKeyFrame KeyTime="0:0:3.5" Value="180"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Arc.StartAngle)" Storyboard.TargetName="arc5">
<EasingDoubleKeyFrame KeyTime="0:0:1.6" Value="180"/>
<EasingDoubleKeyFrame KeyTime="0:0:3.5" Value="270"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Arc.EndAngle)" Storyboard.TargetName="arc5">
<EasingDoubleKeyFrame KeyTime="0:0:1.6" Value="270"/>
<EasingDoubleKeyFrame KeyTime="0:0:3.5" Value="360"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Arc.StartAngle)" Storyboard.TargetName="arc7">
<EasingDoubleKeyFrame KeyTime="0:0:1.6" Value="180"/>
<EasingDoubleKeyFrame KeyTime="0:0:3.5" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Arc.EndAngle)" Storyboard.TargetName="arc7">
<EasingDoubleKeyFrame KeyTime="0:0:1.6" Value="360"/>
<EasingDoubleKeyFrame KeyTime="0:0:3.5" Value="180"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</Grid.Resources>
<Grid x:Name="LayoutRoot" Background="White">
<Image Source="ServerImages/Orange.jpg" Stretch="Fill"/>
<ed:Arc x:Name="arc" ArcThickness="0" ArcThicknessUnit="Pixel" Fill="#FFF4F4F5" Margin="0" Stretch="None" Stroke="#FF811902" StartAngle="0" UseLayoutRounding="False" Width="400" Height="400" HorizontalAlignment="Center" VerticalAlignment="Center" StrokeThickness="4" StrokeStartLineCap="Round" StrokeEndLineCap="Round"/>
<ed:Arc x:Name="arc1" ArcThickness="0" ArcThicknessUnit="Pixel" EndAngle="180" Fill="#FFF4F4F5" Margin="0" Stretch="None" Stroke="#FF811902" StartAngle="90" UseLayoutRounding="False" Width="350" Height="350" HorizontalAlignment="Center" VerticalAlignment="Center" StrokeThickness="4" StrokeStartLineCap="Round" StrokeEndLineCap="Round"/>
<ed:Arc x:Name="arc2" ArcThickness="0" ArcThicknessUnit="Pixel" EndAngle="270" Fill="#FFF4F4F5" Margin="0" Stretch="None" Stroke="#FF811902" StartAngle="180" UseLayoutRounding="False" Width="450" Height="450" HorizontalAlignment="Center" VerticalAlignment="Center" StrokeThickness="4" StrokeStartLineCap="Round" StrokeEndLineCap="Round"/>
<ed:Arc x:Name="arc3" ArcThickness="0" ArcThicknessUnit="Pixel" EndAngle="360" Fill="#FFF4F4F5" Margin="0" Stretch="None" Stroke="#FF811902" StartAngle="270" UseLayoutRounding="False" Width="300" Height="300" HorizontalAlignment="Center" VerticalAlignment="Center" StrokeThickness="4" StrokeStartLineCap="Round" StrokeEndLineCap="Round"/>
<ed:Arc x:Name="arc4" ArcThickness="0" ArcThicknessUnit="Pixel" EndAngle="360" Fill="#FFF4F4F5" Margin="0" Stretch="None" Stroke="#FF811902" StartAngle="270" UseLayoutRounding="False" Width="500" Height="500" HorizontalAlignment="Center" VerticalAlignment="Center" StrokeThickness="4" StrokeStartLineCap="Round" StrokeEndLineCap="Round"/>
<ed:Arc x:Name="arc5" ArcThickness="0" ArcThicknessUnit="Pixel" EndAngle="180" Fill="#FFF4F4F5" Margin="0" Stretch="None" Stroke="#FF811902" StartAngle="90" UseLayoutRounding="False" Width="500" Height="500" HorizontalAlignment="Center" VerticalAlignment="Center" StrokeThickness="4" StrokeStartLineCap="Round" StrokeEndLineCap="Round"/>
<ed:Arc x:Name="arc7" ArcThickness="0" ArcThicknessUnit="Pixel" Fill="#FFF4F4F5" Margin="0" Stretch="None" Stroke="#FF811902" UseLayoutRounding="False" Width="250" Height="250" HorizontalAlignment="Center" VerticalAlignment="Center" StrokeThickness="4" StrokeStartLineCap="Round" StrokeEndLineCap="Round" EndAngle="270"/>
<TextBlock x:Name="tbProgress" Margin="0" TextWrapping="Wrap" Text="0" d:LayoutOverrides="Width, Height" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="64" FontWeight="Bold" Foreground="#FF451701"/>
</Grid>
</Grid>
Problem however is xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing" is not recognized because it inside SDK's folder. How do i get pass this issue? Where should i add this reference of dll. Put in other words i won't be able to use shapes in splash screen?
Thanks in advance :)
In this video it mentions that you can only use functionality that's part of the core Silverlight runtime. I'm guessing that's the problem here.

How to display wpf Splash screen inside main window?

WPF Splash screen getting displayed just as an image not as a window...i mean ...it looks like first an image comes..then...my window(i mean window with a bar at top) comes in...How do I display image inside my main window
just try this
<Window x:Class="WpfApplication43.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="600" Width="800" AllowsTransparency="True" WindowStyle="None" Background="{x:Null}" HorizontalAlignment="Center" VerticalAlignment="Center" WindowStartupLocation="CenterScreen">
<Window.Resources>
<Storyboard x:Key="OnLoaded1">
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="splashGrid" Storyboard.TargetProperty="(UIElement.Opacity)">
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
<SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="1"/>
<SplineDoubleKeyFrame KeyTime="00:00:03" Value="1"/>
<SplineDoubleKeyFrame KeyTime="00:00:04" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="(UIElement.Opacity)">
<SplineDoubleKeyFrame KeyTime="00:00:03.6000000" Value="0"/>
<SplineDoubleKeyFrame KeyTime="00:00:04.3000000" Value="1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</Window.Resources>
<Window.Triggers>
<EventTrigger RoutedEvent="FrameworkElement.Loaded">
<BeginStoryboard Storyboard="{StaticResource OnLoaded1}"/>
</EventTrigger>
</Window.Triggers>
<Grid>
<Grid x:Name="LayoutRoot" Opacity="0" Background="#FF180A0A"/>
<Grid RenderTransformOrigin="0.5,0.5" Width="400" Height="300"
x:Name="splashGrid"
Opacity="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Margin="0,0,0,0" >
<Border BorderBrush="Black" BorderThickness="0" CornerRadius="10" Background="#FFAD6868">
<Grid Margin="5">
<Image Margin="0" Source="The_Midnight_Sun_by_Isilmetriel.jpg" Stretch="Fill"/>
</Grid>
</Border>
</Grid>
</Grid>

Why does the animation I copied in from Expression Blend to Silverlight VS project only run once?

In my Silverlight application, I want different texts to repeatedly fly in from the right changing colors and getting smaller. The animation works the first time through the loop but not subsequent times.
Here's what I did:
(1) I went into Expression blend, used the "Create Storyboard" tool to create the animation.
then (2) copied the StoryBoard block to my XAML:
<UserControl x:Class="TestWeb124.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="800" Height="600">
<UserControl.Resources>
<Storyboard x:Key="FadeTextIn">
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="OutputText" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
<SplineDoubleKeyFrame KeyTime="00:00:01.5000000" Value="-111" KeySpline="0,0,0,1"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="OutputText" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
<SplineDoubleKeyFrame KeyTime="00:00:01.5000000" Value="-88" KeySpline="0,0,0,1"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="OutputText" Storyboard.TargetProperty="(TextBlock.FontSize)">
<SplineDoubleKeyFrame KeyTime="00:00:01.5000000" Value="14" KeySpline="0,0,0,1"/>
</DoubleAnimationUsingKeyFrames>
<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="OutputText" Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)">
<SplineColorKeyFrame KeyTime="00:00:00" Value="#FFC24343"/>
<SplineColorKeyFrame KeyTime="00:00:01.5000000" Value="#FF000000" KeySpline="0,0,0,1"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>
</UserControl.Resources>
<Grid x:Name="LayoutRoot" Background="White">
<StackPanel Margin="20">
<TextBlock Height="57" Margin="190,90,133,0" VerticalAlignment="Top" Text="This is a test." TextWrapping="Wrap" FontSize="36" RenderTransformOrigin="0.5,0.5" x:Name="OutputText" Foreground="#FF000000">
<TextBlock.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</TextBlock.RenderTransform>
</TextBlock>
</StackPanel>
</Grid>
</UserControl>
Then (3) in my code behind I run through a timer loop. The animation works great the first time, but subsequent times there is no animation:
public void Each_Tick(object o, EventArgs sender)
{
if (_secondsElapsed % 5 == 0 || _secondsElapsed == 0)
{
OutputText.Text = String.Format("{0}", _customerFirstNames.ElementAt(_customerNodeIndex));
Storyboard fadeTextIn = (Storyboard)Resources["FadeTextIn"];
fadeTextIn.Begin();
_customerNodeIndex++;
if (_customerNodeIndex > _customerFirstNames.Count() - 1) _customerNodeIndex = 0;
}
_secondsElapsed++;
}
It seems that I need to reset the position of the new piece next piece of text that is supposed to fly it. How do I do that?
<Storyboard x:Name="FadeTextIn">
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="OutputText" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0" KeySpline="0,0,0,1"/>
<SplineDoubleKeyFrame KeyTime="00:00:01.5000000" Value="-111" KeySpline="0,0,0,1"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="OutputText" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0" KeySpline="0,0,0,0"/>
<SplineDoubleKeyFrame KeyTime="00:00:01.5000000" Value="-88" KeySpline="0,0,0,1"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="OutputText" Storyboard.TargetProperty="(TextBlock.FontSize)">
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="36" KeySpline="0,0,0,0"/>
<SplineDoubleKeyFrame KeyTime="00:00:01.5000000" Value="14" KeySpline="0,0,0,1"/>
</DoubleAnimationUsingKeyFrames>
<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="OutputText" Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)">
<SplineColorKeyFrame KeyTime="00:00:00" Value="#FFC24343"/>
<SplineColorKeyFrame KeyTime="00:00:01.5000000" Value="#FF000000" KeySpline="0,0,0,1"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>
What the Storyboard is doing is to take an Element and then animate the manipulation of it's properties. That's why the second time it runs the Element already has the target properties, so by adding a keyframe for the start of the animation that sets the values to the initial values your animation will repeat nicely.

Resources