Home > Microsoft .Net Development Tips > Microsoft Office Development > Beginning Windows Presentation Foundation development, Part 2
Win Development Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

MICROSOFT OFFICE DEVELOPMENT

Beginning Windows Presentation Foundation development, Part 2


Brian Eastwood, Site Editor
06.25.2007
Rating: --- (out of 5)


Office Development Channel
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


Some Windows Presentation Foundation news has been made since SearchVB.com penned its first Beginning WPF development tip in November 2006 -- enough news that it seemed prudent to produce a second tip.

For starters, the tips, videos and additional WPF learning content that Microsoft has assembled have all moved to WindowsClient.NET, a site that, as its name suggests, focuses on client applications in the .NET Framework 3.0. This new site was launched at Tech Ed 2007 and coincided with the announcement of Acropolis, a set of components and other tools for use with both Windows Presentation Foundation and WinForms.

Developers may think they have to choose either WinForms or WPF controls, but, in fact, it is possible for both types of controls to be in the same application, thereby eliminating the need for a large-scale application migration. At Tech Ed 2007, Brian Noyes explained how to work with the two frameworks; the SearchVB.com story Letting WinForms and WPF controls coexist has the details.

When it comes to considering Windows Presentation Foundation controls, it is a good idea to look inside the proverbial box first. There are numerous controls for buttons, TextBoxes, graphics and so on baked right into WPF. Inevitably, though, someone -- a graphic designer, the CEO, Bob from accounting -- will want a custom control.

In such cases, there are a few things to keep in mind, Shaun Wildermuth notes in the MSDN article Customizing Controls for Windows Presentation Foundation.
More on WPF development
Introducing WPF: Chapter 1 of Essential Windows Presentation Foundation

Using WPF to give .NET applications that missing something

If all you need to do is change the appearance of an out-of-the-box control, then styles and templates will do, Wildermuth says. If, however, you need to go beyond that, then there are two options. User controls are made of existing components and, thus, do not need complex customization. Custom controls, on the other hand, give developers full control over appearance and rendering. When in doubt, he suggests, go with a user control.

If talk of WPF controls flies over your head just a bit, and you are looking for more of an overview of Windows Presentation Foundation, then you could do worse that check out the recent CodeProject tip series, A Guided Tour of WPF. This is a five-part series by Josh Smith, a developer currently working on the New York Times Reader WPF-based application.

Part 1 focuses on XAML, the Extensible Application Markup Language that sits in code-behind files and makes UI styling quite a bit easier in Windows Presentation Foundation. It also introduces the admittedly silly horse race application that serves as the sample throughout the series.

Part 2 looks at the layout panel, a concept familiar to Web applications but hitherto absent from traditional client applications. Because this layout system is so extensible, the architects of WPF introduced the concept of attached properties. This, Smith notes, will "set a layout property on a visual element in a panel without that element ever knowing about the panel or its properties."

Part 3 offers some thoughts on data binding in Windows Presentation Foundation, which is flexible enough that developers can, with the use of one API, bind to business objects, XML, ADO.NET data containers, collections and so on. This is possible because WPF introduces dependency properties; these can be bound, can be set in XAML and behave similarly to WinForms' ambient properties, Smith says.

Part 4 considers data templates and triggers. The former are one of many types of templates in WPF; others include control templates, items panel templates and hierarchical data templates. Triggers, meanwhile, conditionally apply values to properties within a data template, such as changing the color of a block of text from black to red when a cursor is hovering over it.

Part 5 discusses styles in Windows Presentation Foundation, which are quite similar to Cascading Style Sheets in the wide world of Web development. In WPF, a style object can be applied to a specific type of UI element; it "really just boils down to a convenient way to apply property settings to one or more visual elements," Smith says.

With Visual Studio 2008 (formerly Visual Studio Orcas) set for release by the end of 2007 -- yes, that's correct -- we expect additional tips and tricks for Windows Presentation Foundation development to continue to emerge. Stay tuned for more, and feel free to send us your favorite WPF resources.

Rate this Tip
To rate tips, you must be a member of SearchWinDevelopment.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


RELATED CONTENT
Windows Presentation Foundation
Fast guide: Silverlight blogs
Modeling tool provides 3D components for WPF apps
VantagePoint WPF Controls delivers rich suite of UI components
Mobiform releases WPF component set
ComponentOne adds rich-text editor to Studio Enterprise
Windows Developments: Product news, December 2007
Book Excerpt: What's new in Windows Presentation Foundation
What Visual Studio 2008 brings to client application development
Infragistics updates its presentation layer components
VB code: Graphics downloads
Windows Presentation Foundation Research

Microsoft Office Development
Check the MSDN Virtual Labs for regular, compelling new content
Windows XP SP3 pack includes new XML parser, enhanced IP security
Book excerpt: Building personalized solutions in SharePoint 2007
Book excerpt: Building document management solutions in SharePoint 2007
XAML as an everywhere presentation format
Where are the Visual Studio 2008 Tools for Office?
ClickOnce: Automated smart client deployment
Book excerpt: SharePoint 2007 and content types
Update desktops automatically using the AppUpdater component
VantagePoint WPF Controls delivers rich suite of UI components

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
GUI  (SearchWinDevelopment.com)
Silverlight  (SearchWinDevelopment.com)
vector graphics  (SearchWinDevelopment.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.

About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 2000 - 2008, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts