Home > Technology > WPF Challenges

WPF Challenges

April 22nd, 2010 Leave a comment Go to comments

Has anyone played with the old PresentationFramework.dll themes?  I usually use the WPF Themes from CodePlex, but I wanted to see how these themes would look.  After all, why wouldn’t I want my app to look like a windows app instead of some quasi-cartoon thingy?

I know I’ve been AWOL for a while.  I’ve been busy with the business.  Monday I searched for a charity.  Tuesday, my new laptop arrived.  I was too busy working through router issues.  Wednesday, I started playing with my laptop and researching a version control solution.  TFS will not work at the office.  I ended up with a free online service.  We’ll see if it works as planned.  Today was more laptop work and adding projects to Subversion.  Tomorrow, I have another new client meeting and a laptop to fix.  My old netbook migrated to my employee.  After Tuesday’s issues he can no longer connect to the network cleanly.

And for a change, I’m using the Windows Live Writer to create this post.  I am trying this to see if it can handle my code samples.

Well, here’s a sample from the ScreenSaver Template in VS2010:

<Window x:Class="Screensaver1.ScreensaverWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    WindowStartupLocation="Manual"
    WindowState="Maximized"
    WindowStyle="None">
    <Grid>
        <ContentControl
                   RenderTransformOrigin="0.5, 0.5"
                   VerticalAlignment="Center"
                   HorizontalAlignment="Center"
                   FontSize="20"
                   Content="{Binding ScreensaverContent}">
            <ContentControl.RenderTransform>
                <ScaleTransform />
            </ContentControl.RenderTransform>
            <ContentControl.Triggers>
                <EventTrigger RoutedEvent="FrameworkElement.Loaded">
                    <BeginStoryboard>
                        <Storyboard>
                            <DoubleAnimationUsingKeyFrames RepeatBehavior="Forever" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)">
                                <SplineDoubleKeyFrame Value="2" KeyTime="00:00:05" />
                                <SplineDoubleKeyFrame Value="1" KeyTime="00:00:10" />
                            </DoubleAnimationUsingKeyFrames>
                            <DoubleAnimationUsingKeyFrames RepeatBehavior="Forever" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)">
                                <SplineDoubleKeyFrame Value="2" KeyTime="00:00:05" />
                                <SplineDoubleKeyFrame Value="1" KeyTime="00:00:10" />
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
            </ContentControl.Triggers>
        </ContentControl>
    </Grid>
</Window>

And here is another insert tool’s snippet:

   1: <Window x:Class="Screensaver1.ScreensaverWindow"

 

   2:     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

 

   3:     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

 

   4:     WindowStartupLocation="Manual"

 

   5:     WindowState="Maximized"

 

   6:     WindowStyle="None">

 

   7:     <Grid>

 

   8:         <ContentControl

 

   9:                    RenderTransformOrigin="0.5, 0.5"

 

  10:                    VerticalAlignment="Center"

 

  11:                    HorizontalAlignment="Center"

 

  12:                    FontSize="20"

 

  13:                    Content="{Binding ScreensaverContent}">

 

  14:             <ContentControl.RenderTransform>

 

  15:                 <ScaleTransform />

 

  16:             </ContentControl.RenderTransform>

 

  17:             <ContentControl.Triggers>

 

  18:                 <EventTrigger RoutedEvent="FrameworkElement.Loaded">

 

  19:                     <BeginStoryboard>

 

  20:                         <Storyboard>

 

  21:                             <DoubleAnimationUsingKeyFrames RepeatBehavior="Forever" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)">

 

  22:                                 <SplineDoubleKeyFrame Value="2" KeyTime="00:00:05" />

 

  23:                                 <SplineDoubleKeyFrame Value="1" KeyTime="00:00:10" />

 

  24:                             </DoubleAnimationUsingKeyFrames>

 

  25:                             <DoubleAnimationUsingKeyFrames RepeatBehavior="Forever" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)">

 

  26:                                 <SplineDoubleKeyFrame Value="2" KeyTime="00:00:05" />

 

  27:                                 <SplineDoubleKeyFrame Value="1" KeyTime="00:00:10" />

 

  28:                             </DoubleAnimationUsingKeyFrames>

 

  29:                         </Storyboard>

 

  30:                     </BeginStoryboard>

 

  31:                 </EventTrigger>

 

  32:             </ContentControl.Triggers>

 

  33:         </ContentControl>

 

  34:     </Grid>

 

  35: </Window>

And another…

   1:  <Window x:Class="Screensaver1.ScreensaverWindow"

 

   2:      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

 

   3:      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

 

   4:      WindowStartupLocation="Manual"

 

   5:      WindowState="Maximized"

 

   6:      WindowStyle="None">

 

   7:      <Grid>

 

   8:          <ContentControl

 

   9:                     RenderTransformOrigin="0.5, 0.5"

 

  10:                     VerticalAlignment="Center"

 

  11:                     HorizontalAlignment="Center"

 

  12:                     FontSize="20"

 

  13:                     Content="{Binding ScreensaverContent}">

 

  14:              <ContentControl.RenderTransform>

 

  15:                  <ScaleTransform />

 

  16:              </ContentControl.RenderTransform>

 

  17:              <ContentControl.Triggers>

 

  18:                  <EventTrigger RoutedEvent="FrameworkElement.Loaded">

 

  19:                      <BeginStoryboard>

 

  20:                          <Storyboard>

 

  21:                              <DoubleAnimationUsingKeyFrames RepeatBehavior="Forever" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)">

 

  22:                                  <SplineDoubleKeyFrame Value="2" KeyTime="00:00:05" />

 

  23:                                  <SplineDoubleKeyFrame Value="1" KeyTime="00:00:10" />

 

  24:                              </DoubleAnimationUsingKeyFrames>

 

  25:                              <DoubleAnimationUsingKeyFrames RepeatBehavior="Forever" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)">

 

  26:                                  <SplineDoubleKeyFrame Value="2" KeyTime="00:00:05" />

 

  27:                                  <SplineDoubleKeyFrame Value="1" KeyTime="00:00:10" />

 

  28:                              </DoubleAnimationUsingKeyFrames>

 

  29:                          </Storyboard>

 

  30:                      </BeginStoryboard>

 

  31:                  </EventTrigger>

 

  32:              </ContentControl.Triggers>

 

  33:          </ContentControl>

 

  34:      </Grid>

 

  35:  </Window>

Three different views of the same content.  I’ll have to think about it. It is interesting how all of the colors are lost in the translations.

 

 ;)  (That would be an emotion insert.)

  1. No comments yet.
  1. No trackbacks yet.
You must be logged in to post a comment.