PhotoPlay – WPF – It Lives!

Ok – so tonight I finally had the courage to install Visual Studio 2008 Beta 2 on my relatively new and until now pristinely clean development machine. The install process was the standard tried and true Visual Studio install engine and completed slowly but without any problems (only one reboot required).

So I immediately fire up Visual Studio 2008 – choose the C# preferences which gives me all the wrong keyboard shortcuts (I can never remember which is which). Create a new WPF application with solution folder. The add a new WPF user control library to the project. So far so good.

Renaming UserControl1 to PhotoPage and changing the namespaces turns out to be as bad as renaming in Visual Studio 2005. Have to rename the file, class, namespace and XAML all independently.

First impressions:

  • XAML editor hasn’t immediately crashed – way more stable than previous builds!
  • XAML editor is almost real-time and is only a little slow to load – way faster than previous builds!
  • WPF has changed everything – even finding equivalent of BackColor to create a coloured background takes time. At least Fill is spelt correctly :-p
  • XAML Intellisense is great for auto-complete – but where are the help tooltips?
  • Hmm… appears Shapes have a Fill and controls have a Background.
  • Don’t click on the helpful sounding message telling you the assembly has changed and XAML needs to be refreshed. Seems to crash Visual Studio every time

My first attempt at a XAML only approach:

PhotoClass : UserControl

<UserControl x:Class="Spencen.Windows.Controls.Photo"
        <Border Name="OuterFrame" CornerRadius="5">
                <LinearGradientBrush Opacity="0.8">
                    <GradientStop Color="Azure" Offset="0.0"/>
                    <GradientStop Color="CadetBlue" Offset="1.0"/>
            <Border Name="InnerFrame" Background ="White" BorderBrush="Black" 
="6,6,6,6"> <Image Name="image2" Margin="1, 1, 1, 1"> <Image.Source>
F:\Pictures\Camera Photos\2007\Mount Hotham\DSC06994.JPG
> </Image> </Border> </Border> </StackPanel> </UserControl>

PhotoPlayWindow : Window

<Window x:Class="Spencen.Windows.PhotoPlayWindow"
    Title="PhotoPlayWPF" Height="428" Width="619">
        <Slider Name="scaleSlider" Height="21" Width="100" 
Minimum="0.1" Maximum="5.0" Value="1.0"/> <Slider Name="angleSlider" Height ="21" Width="100"
="-180.0" Maximum="180.0" Value="0.0"/> <p:Photo Height="230" Width="300" Name="testPhoto"> <p:Photo.LayoutTransform> <TransformGroup> <ScaleTransform ScaleX="{Binding ElementName=scaleSlider, Path=Value}"
="{Binding ElementName=scaleSlider, Path=Value}"/> <RotateTransform Angle="{Binding ElementName=angleSlider, Path=Value}"
="150" CenterY="150"/> </TransformGroup> </p:Photo.LayoutTransform> </p:Photo> </StackPanel> </Window>


6 thoughts on “PhotoPlay – WPF – It Lives!”

Comments are closed.