Porting a Win Forms app to WPF - PowerPoint PPT Presentation

1 / 13
About This Presentation
Title:

Porting a Win Forms app to WPF

Description:

One file containing platform specific methods. The other containing platform independent methods. Platform Independent. Methods to load local data. Methods to ... – PowerPoint PPT presentation

Number of Views:107
Avg rating:3.0/5.0
Slides: 14
Provided by: dev11
Category:

less

Transcript and Presenter's Notes

Title: Porting a Win Forms app to WPF


1
Porting a Win Forms app to WPF
  • Caleb Vear, dotNET solutions

2
Overview
  • An Introduction to WPF
  • How I ported the catalog application
  • Issues with the porting process

3
What do you need to develop WPF applications?
  • The .NET 3 Frameworkhttp//www.microsoft.com/down
    loads/details.aspx?FamilyID10cc340b-f857-4a14-83f
    5-25634c3bf043DisplayLangen
  • Visual Studio 2005 extensions for .NET
    3.0http//www.microsoft.com/downloads/details.asp
    x?FamilyIDf54f5537-cc86-4bf5-ae44-f5a1e805680dDi
    splayLangen
  • Microsoft Windows SDK for Windows
    Vistahttp//www.microsoft.com/downloads/details.a
    spx?familyid7614FE22-8A64-4DFB-AA0C-DB53035F40A0
    displaylangen
  • Expression Blendhttp//www.microsoft.com/expressi
    on/products/overview.aspx?keyblend

4
What is WPF?
  • WPF is a new API for building Windows
    applications

5
What is WPF good for?
  • To enable designers and developers to work
    together
  • To allow an easy way to customize the look of
    controls without changing its behaviour
  • To allow 3D graphics more easily in Windows
    applications
  • To allow an easy way to do animations in Windows
    applications
  • To enable the creation of applications which
    scale nicely to
  • high resolution screens

6
Overview of WPF Architecture
  • Most of WPF is written in managed code
  • milcore is the only unmanaged component of WPF

7
Important WPF Concepts
  • XAML Extensible Application Mark-up Language
  • Dependency Properties
  • Routed Events
  • Commands
  • Styles
  • Control Templates

8
Dependency Properties Example
ltWindow xClass"WindowsApplication1.Window1"
xmlns"http//schemas.microsoft.com/winfx/2006/xa
ml/presentation" xmlnsxhttp//schemas.micro
soft.com/winfx/2006/xaml gt ltGrid xName"myGrid"
Margin"20"gt ltTextBlockgt Sample Text outside
the ItemsControl block lt/TextBlockgt ltItemsContro
l Foreground"Red" VerticalAlignment"Center"gt lt
TextBlockgtSample Text without foregroundlt/TextBloc
kgt ltTextBlock Foreground"Blue"gtSample Text
with foregroundlt/TextBlockgt lt/ItemsControlgt lt/Gri
dgt lt/Windowgt
9
Routed Events
10
How did I port the application?
  • Created a new WPF project
  • Created a test project for testing styles
  • Shared the non Windows Forms class files
  • Separated the main form into two partial class
    files
  • One file containing platform specific methods
  • The other containing platform independent methods

11
Platform Independent
Platform Dependent
  • Methods to load local data
  • Methods to cache data
  • Methods to load data from the web service
  • Methods to change the cursor
  • Properties to set the status bar text
  • Methods to show the different pages

12
Issues
  • The Frame control doesnt support scripting
    objects
  • Layout issues with Winforms on WPF
  • Winforms controls will always be rendered over
    the top of WPF controls
  • Winforms controls cant be scaled or transformed
  • Winforms controls cant be rotated or skewed

13
Useful Links
  • Windows Presentation Foundation SDK Blog
  • http//blogs.msdn.com/wpfsdk/
  • WPFPedia.com
  • http//www.wpfpedia.com
  • Windows Vista Technical Articles
  • A Guided Tour of Windows Presentation Foundation
  • http//msdn2.microsoft.com/en-us/library/aa480221.
    aspx
Write a Comment
User Comments (0)
About PowerShow.com