Have just finished a year-long WPF project and I absolutely adore WPF.
I love the fact you can do crazy things like embed a movie as the border of a textbox, or you can bind the Visual property of something as the visual of something else (eg, binding the visual property of a MediaElement as the visual property of a panel so it gives you a very efficient reflection of the movie playing - see below)
I LOVE WPF LOVE IT LOVE IT LOVE IT. Unfortunately, now I'm stablising some old code. .NET 2.0 WinForms. Lovely.... :-\
XAML code:
<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"; xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"; Margin="0" Background="#FFC0C0C0">
<StackPanel Margin="34">
<MediaElement Source="C:\video.wmv" Width="300" Name="mypic"/>
<!-- <Image Source="C:\picture.jpg" Width="300" Name="mypic"/> -->
<Rectangle Height="{Binding ElementName=mypic, Path=ActualHeight}" Width="{Binding ElementName=mypic, Path=ActualWidth}">
<Rectangle.Fill>
<VisualBrush Visual="{Binding ElementName=mypic}"/>
</Rectangle.Fill>
<Rectangle.LayoutTransform>
<ScaleTransform ScaleY="-0.7"/>
</Rectangle.LayoutTransform>
<Rectangle.OpacityMask>
<LinearGradientBrush EndPoint="0,1">
<GradientStop Offset="0" Color="Transparent"/>
<GradientStop Offset="1" Color="#77000000"/>
</LinearGradientBrush>
</Rectangle.OpacityMask>
</Rectangle>
</StackPanel>
</UserControl>
Just make sure C:\video.wmv is a valid movie file.
I also love the runtime-evaluation of binding. For example, you can bind to a property of type 'Object' and in the XAML bind to a property that may or may not exist at runtime:
XAML code:
<TextBlock Text="{Binding ElementName=SomeObject, Path=MyProperty}" />
If it exists, it works, if not, it silently ignores it.
This is VERY useful. And she's quite hot: http://www.beacosta.com/blog/ |