dev340 - softinsight.comsoftinsight.com/downloads/conferences/teched2007/... · visual studio 2008...

16
6/13/2007 © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 1 DEV340

Upload: others

Post on 06-Jul-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: DEV340 - softinsight.comsoftinsight.com/downloads/Conferences/TechEd2007/... · Visual Studio 2008 Design-Time Support ElementHost Windows Forms control that hosts a single WPF Element

6/13/2007

© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 1

DEV340

Page 2: DEV340 - softinsight.comsoftinsight.com/downloads/Conferences/TechEd2007/... · Visual Studio 2008 Design-Time Support ElementHost Windows Forms control that hosts a single WPF Element

6/13/2007

© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 2

Chief Architect, IDesign Inc. (www.idesign.net) Microsoft Regional Director/MVPWriting

“Developing Applications with Windows Workflow Foundation,” LiveLessons, June 2007Smart Client Deployment with ClickOnce, Addison-Wesley, Dec 2006Data Binding in Windows Forms 2.0, Addison-Wesley, January 2006MSDN Magazine, MSDN Online, CoDe Magazine, TheServerSide.NET, asp.netPRO, Visual Studio Magazine

SpeakingMicrosoft TechEd US, Europe, Malaysia, Visual Studio Connections, DevTeach, INETA Speakers Bureau, MSDN Webcasts

Participates in Microsoft Design ReviewsE-mail: [email protected]: http://www.softinsight.com/bnoyes

WPF/Windows Forms Interoperability Overview

Hosting WPF Controls in Windows Forms

Hosting Windows Forms Controls in WPF

Interoperability Challenges

Using Property Maps

Visual Studio 2008 Design-Time Support

Page 3: DEV340 - softinsight.comsoftinsight.com/downloads/Conferences/TechEd2007/... · Visual Studio 2008 Design-Time Support ElementHost Windows Forms control that hosts a single WPF Element

6/13/2007

© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 3

WPF adoption is not all or nothingLeverage existing investment in Windows Forms controls or applicationsUse the capabilities of WPF incrementatally as needed

WPF design tools are immatureMicrosoft Visual Studio tools not releasedMicrosoft Expression Blend for UI designers, not as much for developers (although pretty good for the latter as well)

Windows Forms control suite is more comprehensive than WPF (at this point in time)

DataGridView/DataGridXceed / Infragistics/etc. options

BindingNavigatorColorDialogDateTimePickerErrorProviderFontDialogFolderBrowserDialogMaskedTextBoxetc.

Page 4: DEV340 - softinsight.comsoftinsight.com/downloads/Conferences/TechEd2007/... · Visual Studio 2008 Design-Time Support ElementHost Windows Forms control that hosts a single WPF Element

6/13/2007

© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 4

Can easily hostWPF controls in Windows FormsWindows Forms controls in WPF

Direction choiceWPF in Windows Forms

Existing Windows Forms app that you are adding new graphics capabilities to

Windows Forms in WPFLeverage existing investment in Windows Forms controls or compensate for missing controls in WPF

WPF and Windows Forms controls and components are still just .NET class instances

References to objects on the heapCan use non-visual components from either framework in the other

Ex: WPF Line object is just a data structureRendering engines are very different, so need different screen ownership model

Shared screen areas may not behave as expected

Page 5: DEV340 - softinsight.comsoftinsight.com/downloads/Conferences/TechEd2007/... · Visual Studio 2008 Design-Time Support ElementHost Windows Forms control that hosts a single WPF Element

6/13/2007

© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 5

WPF/Windows Forms Interoperability Overview

Hosting WPF Controls in Windows Forms

Hosting Windows Forms Controls in WPF

Interop Challenges

Using Property Maps

Visual Studio 2008 Design-Time Support

ElementHostWindows Forms control that hosts a single WPF Element

Typically a composite WPF controlProvides rendering container for hosted WPF element within a Form/ControlHosting Windows Forms Control in WPFExposes properties to control the presentation of the hosted element within the ElementHost container

Page 6: DEV340 - softinsight.comsoftinsight.com/downloads/Conferences/TechEd2007/... · Visual Studio 2008 Design-Time Support ElementHost Windows Forms control that hosts a single WPF Element

6/13/2007

© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 6

Create or obtain the WPF controlCreate the Windows Forms host applicationAdd reference to the WindowsFormsIntegration assemblyCreate an ElementHost control in the Windows FormCreate instance of WPF controlSet the WPF control as the Child of the ElementHostAdd the host to the Controls collectionfor the container

Form, user control, or composite control

Page 7: DEV340 - softinsight.comsoftinsight.com/downloads/Conferences/TechEd2007/... · Visual Studio 2008 Design-Time Support ElementHost Windows Forms control that hosts a single WPF Element

6/13/2007

© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 7

WPF/Windows Forms Interoperability Overview

Hosting WPF Controls in Windows Forms

Hosting Windows Forms Controls in WPF

Interoperability Challenges

Using Property Maps

Visual Studio 2008 Design-Time Support

WindowsFormsHostWPF Element that hosts a single Windows Forms controlProvides rendering container for Windows Forms within WPF Window/Control/PageSystem.Windows.Forms.Integration namespaceExposes properties to control the presentation of the hosted control within the WindowsFormsHost container

Page 8: DEV340 - softinsight.comsoftinsight.com/downloads/Conferences/TechEd2007/... · Visual Studio 2008 Design-Time Support ElementHost Windows Forms control that hosts a single WPF Element

6/13/2007

© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 8

Create or obtain the Windows Forms controlCreate the WPF host applicationAdd reference to the WindowsFormsIntegration assemblyAdd WindowsFormsHost control to window/pageCreate instance of WinForms controlSet as Child of WindowsFormsHostAdd the host to the Children collection

Implicit in XAML based on the element hierarchy

Page 9: DEV340 - softinsight.comsoftinsight.com/downloads/Conferences/TechEd2007/... · Visual Studio 2008 Design-Time Support ElementHost Windows Forms control that hosts a single WPF Element

6/13/2007

© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 9

WPF/Windows Forms Interoperability Overview

Hosting WPF Controls in Windows Forms

Hosting Windows Forms Controls in WPF

Interoperability Challenges

Using Property Maps

Visual Studio 2008 Design-Time Support

FocusStylingOverlapCoordinatesWindows Forms Instancing in PagesOpacity

Page 10: DEV340 - softinsight.comsoftinsight.com/downloads/Conferences/TechEd2007/... · Visual Studio 2008 Design-Time Support ElementHost Windows Forms control that hosts a single WPF Element

6/13/2007

© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 10

WPF/Windows Forms Interoperability Overview

Hosting WPF Controls in Windows Forms

Hosting Windows Forms Controls in WPF

Interoperability Challenges

Using Property Maps

Visual Studio 2008 Design-Time Support

Page 11: DEV340 - softinsight.comsoftinsight.com/downloads/Conferences/TechEd2007/... · Visual Studio 2008 Design-Time Support ElementHost Windows Forms control that hosts a single WPF Element

6/13/2007

© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 11

Map changes in host properties to changes in hosted control/element

Example: Background in WPF -> BackColor in Windows Forms

Automatic detection and value passingOnly works for certain properties

Can add custom handling of mapping processhost.PropertyMap.Add()Delegate pointing to method with signature

void MethodName(object hostObj, string propName, object valueBeingSet)

Page 12: DEV340 - softinsight.comsoftinsight.com/downloads/Conferences/TechEd2007/... · Visual Studio 2008 Design-Time Support ElementHost Windows Forms control that hosts a single WPF Element

6/13/2007

© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 12

WPF/Windows Forms Interoperability Overview

Hosting WPF Controls in Windows Forms

Hosting Windows Forms Controls in WPF

Interoperability Challenges

Using Property Maps

Visual Studio 2008 Design-Time Support

Add WPF controls and element host from designerToolbox item drag and dropSome ElementHost properties settable from designerContained control properties and events not accessible from designer

Drop to code

Windows Forms to WPF support TBD

Page 13: DEV340 - softinsight.comsoftinsight.com/downloads/Conferences/TechEd2007/... · Visual Studio 2008 Design-Time Support ElementHost Windows Forms control that hosts a single WPF Element

6/13/2007

© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 13

Windows Presentation Foundation Unleashed, Adam Nathan, Sams Publishing

Programming WPF, Chris Sells and Ian Griffiths, Addison-Wesley

Windows Forms 2.0 Programming, Chris Sells and Michael Weinhardt, Addison-Wesley

Essential Windows Presentation Foundation, Chris Anderson, Addison-Wesley

Page 14: DEV340 - softinsight.comsoftinsight.com/downloads/Conferences/TechEd2007/... · Visual Studio 2008 Design-Time Support ElementHost Windows Forms control that hosts a single WPF Element

6/13/2007

© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 14

Technical Communities, Webcasts, Blogs, Chats & User Groupshttp://www.microsoft.com/communities/default.mspx

Microsoft Developer Network (MSDN) & TechNet http://microsoft.com/msdnhttp://microsoft.com/technet

Trial Software and Virtual Labshttp://www.microsoft.com/technet/downloads/trials/default.mspx

Microsoft Learning and Certificationhttp://www.microsoft.com/learning/default.mspx

Email: [email protected]: http://www.softinsight.com/bnoyes

WednesdayBuilding Microsoft Windows Communication Foundation and Windows Workflow Foundation Applications with Microsoft Visual Studio 2008 5:30

ThursdayMicrosoft Visual C# Under the Covers: An In-Depth Look at C# 3.0 8:00

TuesdayThe .NET Language Integrated Query (LINQ) Framework 8:30LINQ and XML for the Microsoft Visual Basic Developer 10:15Building Smart Client Applications in Microsoft Visual Studio 2008 10:15Building a Complete Web Application Using ASP.NET "Orcas" and Microsoft Visual Studio 2008 (Two parts) 10:15 and 1Microsoft Visual C#: Tips and Tricks for the Microsoft Visual Studio 2008 IDE 1:00Microsoft Visual Basic: Tips and Tricks for the Microsoft Visual Studio 2008 IDE 2:45Building Microsoft Windows Presentation Foundation Applications with Microsoft Visual Studio 2008 and Microsoft Expression Blend 4:30

MondayA Lap Around Microsoft Visual Studio 2008 (Session repeats on 6/8) 10:30Overview of Microsoft Visual Studio 2008 for Devices and .NET Compact Framework 3.5 4:45

FridayUsing the .NET Language Integrated Query (LINQ) Framework with Relational Data 9:00A Lap Around Microsoft Visual Studio 2008 (Repeated from 6/4) 1:00What's New in Microsoft Visual Studio Team System for Testers, New Features in Visual Studio 2008 and Best Practices for Testing AJAX, SharePoint, and Reporting Services 1:00

Page 15: DEV340 - softinsight.comsoftinsight.com/downloads/Conferences/TechEd2007/... · Visual Studio 2008 Design-Time Support ElementHost Windows Forms control that hosts a single WPF Element

6/13/2007

© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 15

Thursday:Enhancing ASP.NET AJAX Applications with Silverlight 8:00Silverlight Tips and Tricks 4:30

Monday:A Lap Around Silverlight 4:45

Friday:Creating and Delivering Rich Media and Video on the Web with Silverlight, Expression Studio, and Windows Server 2008 9:00Building Rich Internet Applications with Silverlight 1:00Building Interactive Media Experiences with Silverlight 2:45

Links:Scott Guthrie on Channel 9 - http://channel9.msdn.com/showpost.aspx?postid=304508Silverlight Developer Center - http://msdn2.microsoft.com/en-us/silverlight/default.aspxSilverlight Alpha 1.1 SDK - http://msdn.microsoft.com/vstudio/eula.aspx?id=c8bf88e7-841c-43fd-c63d-379943617f36

Complete an Complete an evaluation on evaluation on

CommNetCommNet and and enter to win!enter to win!

Complete an Complete an evaluation on evaluation on

CommNetCommNet and and enter to win!enter to win!

Page 16: DEV340 - softinsight.comsoftinsight.com/downloads/Conferences/TechEd2007/... · Visual Studio 2008 Design-Time Support ElementHost Windows Forms control that hosts a single WPF Element

6/13/2007

© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 16

© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market

conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.