Silverlight 3 Pixel Shader Effects
Silverlight 3 has given us some cool effects such as drop shadows and motion blur, these are available through the new Pixel Shader Effect property and are very easy to use.

You need to login to Download this Pixel Shader example, If you do not have a login you can register for free!
We can achieve these effects in XAML with no C# required, here we show you some examples of using Drop Shadows and Motion Blur:
<UserControl x:Class="Effects.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="600" Height="300">
<Grid x:Name="LayoutRoot" Background="White">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<StackPanel Margin="8" Grid.Column="0">
<TextBlock Text="A Drop Shadow!" FontSize="20">
<TextBlock.Effect>
<DropShadowEffect />
</TextBlock.Effect>
</TextBlock>
<TextBlock Text="A Slight Drop Shadow!" FontSize="20">
<TextBlock.Effect>
<DropShadowEffect ShadowDepth="2" />
</TextBlock.Effect>
</TextBlock>
<TextBlock Text="Blur Effect!" FontSize="20">
<TextBlock.Effect>
<BlurEffect />
</TextBlock.Effect>
</TextBlock>
</StackPanel>
<StackPanel Margin="8" Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Top">
<Rectangle Width="100" Height="100" Fill="Red">
<Rectangle.Effect>
<DropShadowEffect ShadowDepth="2" />
</Rectangle.Effect>
</Rectangle>
<Ellipse Height="100" Width="100" Fill="Yellow" Margin="10 0 0 0">
<Ellipse.Effect>
<DropShadowEffect ShadowDepth="2" />
</Ellipse.Effect>
</Ellipse>
</StackPanel>
</Grid>
</UserControl>
If anybody has had the chance to play with Pixel Shaders in XNA or Direct X you will be pleased to know the Silverlight 3 Pixel Shaders are just as powerful and customizable.
Post your Comments
No comments found.