Click here to Skip to main content
15,881,693 members
Articles / Desktop Programming / WPF

Windows7 / VS2010 / WPF 4 Demo App

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
27 Nov 2009CPOL1 min read 17.6K   5  
Windows7 / VS2010 / WPF 4 demo app

The other day, I finished up a small demo app that I was writing over at www.codeproject.com which covers several of the new Windows7 features such as TaskBars/JumpLists.

The finished article looks like this:

45178/start2_thumb.jpg

45178/start4_thumb.jpg

45178/start5_thumb.jpg

45178/task_thumb.jpg

The idea behind this demo app is actually very simple, I wanted to show how to use the Managed Extensibility Framework (MEF) to add in a bunch of Pixel Shaders that were inside a separate assembly. I also use some of the new .NET 4.0 goodies such as Dynamic and ExpandoObject.

The demo app also show cases how to use the new System.Windows.Shell namespace.

In case you are wondering, here is how you would create a JumpList using the new System.Windows.Shell namespace.

C#
JumpList jumpList = new JumpList();
JumpList.SetJumpList(Application.Current, jumpList);

JumpTask jumpTask = new JumpTask();
jumpTask.Title = "IE";
jumpTask.CustomCategory =
    "Keep Notes";
jumpTask.ApplicationPath =
    @"C:\Program Files\Internet Explorer\iexplore.exe";
String systemFolder =
    Environment.GetFolderPath(
        Environment.SpecialFolder.System);
jumpTask.IconResourcePath =
    @"C:\Program Files\Internet Explorer\iexplore.exe";
jumpTask.IconResourceIndex = 0;
jumpTask.Arguments = "pixel shaders";
jumpList.JumpItems.Add(jumpTask);
jumpList.Apply();

And here is how you can create a TaskBar that can interact with your application code, again using the new System.Windows.Shell namespace.

XML
<Window x:Class="MefFX.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MefFX" Height="600" Width="800">

    <Window.TaskbarItemInfo>
        <TaskbarItemInfo
            ProgressState="Normal"
            Description="Some text"
            ThumbnailClipMargin=
        "{Binding RelativeSource=
            {RelativeSource FindAncestor,
                    AncestorType={x:Type Window}},
            Path=BorderThickness}">
            <TaskbarItemInfo.ThumbButtonInfos>
                <ThumbButtonInfo
                   Click="SearchForPixelShadersInside_Click"
                    DismissWhenClicked="False"
                    ImageSource="Images/ie.png" />
                <ThumbButtonInfo Command="{Binding AboutCommand}"
                    DismissWhenClicked="False"
                    ImageSource="Images/about.png" />
            </TaskbarItemInfo.ThumbButtonInfos>
        </TaskbarItemInfo>

    </Window.TaskbarItemInfo>

....
....
....
....

</Window>

This TaskBar is obviously done in WPF4.0 using XAML but it would be easy enough to do in WinForms using the TaskbarItemInfo class which is in the new System.Windows.Shell namespace.

Anyway, the full article explains all this and a lot more in a lot more detail, so if you feel inclined to have a read through of that, the full article is available over at this link:

Enjoy!

This article was originally posted at http://sachabarber.net?p=609

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United Kingdom United Kingdom
I currently hold the following qualifications (amongst others, I also studied Music Technology and Electronics, for my sins)

- MSc (Passed with distinctions), in Information Technology for E-Commerce
- BSc Hons (1st class) in Computer Science & Artificial Intelligence

Both of these at Sussex University UK.

Award(s)

I am lucky enough to have won a few awards for Zany Crazy code articles over the years

  • Microsoft C# MVP 2016
  • Codeproject MVP 2016
  • Microsoft C# MVP 2015
  • Codeproject MVP 2015
  • Microsoft C# MVP 2014
  • Codeproject MVP 2014
  • Microsoft C# MVP 2013
  • Codeproject MVP 2013
  • Microsoft C# MVP 2012
  • Codeproject MVP 2012
  • Microsoft C# MVP 2011
  • Codeproject MVP 2011
  • Microsoft C# MVP 2010
  • Codeproject MVP 2010
  • Microsoft C# MVP 2009
  • Codeproject MVP 2009
  • Microsoft C# MVP 2008
  • Codeproject MVP 2008
  • And numerous codeproject awards which you can see over at my blog

Comments and Discussions

 
-- There are no messages in this forum --