Download presentation
Presentation is loading. Please wait.
Published byΠολυξένη Κοτζιάς Modified over 6 years ago
1
Building Rich, Interactive Controls for Windows “Longhorn”
12/6/ :20 AM Session Code: 301 Building Rich, Interactive Controls for Windows “Longhorn” Jeff Bogdan Architect Microsoft Corporation © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
2
Avalon’s Controls Charter
12/6/ :20 AM Avalon’s Controls Charter Maximize usage out of the box Provide consistent extensibility mechanisms Build intrinsic controls the same way we expect third parties to build them © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
3
Keys To Building Controls
12/6/ :20 AM Keys To Building Controls Don’t Subclass… …until you’ve tried customizing Exploit Element Composition and save time, improve consistency Choose the Right Base Class and get a great head start Focus on Control Logic and leave the look to Styles © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
4
Client Application Model
12/6/ :20 AM Tools Client Application Model Avalon Windows Forms System.Windows System.Windows.Forms Web & Service Application Model Data Systems Application Model Mobile PC & Devices Application Model Command Line Compact Framework ASP.NET / Indigo Win FS Yukon System.Console Mobile PC Optimized System.Web System.Storage System.Data.SqlServer System.Windows.Forms System.Windows NT Service System.ServiceProcess Presentation Data Communication Animation Controls Control Design Panel Dialogs SideBar Notification System.Windows Documents Text Element Shapes Shape Ink UI Element Explorer Media Navigation System.Search System.Data System.Messaging System. Discovery System.Collaboration Annotations SqlClient DataSet System.DirectoryServices RealTimeEndpoint SqlTypes Mapping Active Directory TransientDataSession Monitoring System.Remoting SqlXML ObjectSpaces SignalingSession Logging System.Runtime.Remoting Uddi OdbcClient ObjectSpace Media Relevance OleDbClient Query Activities OracleClient Schema System.Web.Services System.MessageBus Animation Controls Control Design Panel Dialogs SideBar Notification System.Windows Documents Text Element Shapes Shape Ink UI Element Explorer Media Navigation Web.Service Transport Queue System.Storage System.Windows.Forms System.Web.UI Port PubSub Item Core Description Forms Page WebControls Relationship Contact Discovery Channel Router Control Control Adaptors Service Policy Media Location Protocols Print Dialog HtmlControls Design Peer Group Audio Message Design MobileControls Video Document System.Net Images Event System.Web System.Help System.Speech HttpWebRequest NetworkInformation System.Xml Personalization FtpWebListener Sockets System.Drawing Recognition Synthesis Caching Schema Xpath SslClientStream Cache System.NaturalLanguageServices Serialization Query SessionState WebClient Fundamentals Base & Application Services Security Configuration Deployment/Management System.Timers System.Text System.Collections System.Windows. TrustManagement System.Web.Configuration System.Web System.Globalization System.Design System.Security Generic System.MessageBus.Configuration System.Serialization System.IO System.Web. Security Authorization Permissions Administration System.ComponentModel System.Configuration Management System.Threading Ports AccessControl Policy System.CodeDom System.Resources System.Message Bus.Security Credentials Principal System.Management System.Runtime System.Reflection Cryptography Token System.Deployment Serialization InteropServices System.EnterpriseServices System.Diagnostics CompilerServices System.Transactions © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
5
Five Element Families Control Panel Decorator Shape Content Element
Core Content Element UIElement Object PresentationCore Retained Visual Visual Dependency Object UIContext Object Presentation Framework Framework Element Control Panel Decorator Shape Content Element MSAvalon.Windows.Controls MSAvalon.Windows.Controls.Primitives MSAvalon.Windows. Shapes MSAvalon.Windows. Documents © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
6
Controls* Interactive Elements
12/6/ :20 AM Controls* Interactive Elements Framework Element Control Text Frame Windows FormsHost Scroll Viewer Content Control Text Box Scroll Bar Items Control Slider Button HyperLink ListBox Menu Check Box ToolTip Combo Box Context Menu RadioButton ListItem Radio ButtonList * - Simplified © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
7
12/6/ :20 AM Using vs. Building Find the element(s) that most closely match your needs Set properties Compose Elements Build new Styles Build a new type © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
8
Building An UpDown Control
12/6/ :20 AM Building An UpDown Control © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
9
Styles A package of properties that can be applied to many elements
12/6/ :20 AM Styles A package of properties that can be applied to many elements Defined at System, Application, Pane, or Tree level Style.VisualTree Leverages element composition But doesn’t confuse the application author Aliased Properties Allows VisualTree to consume values set on target Control © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
10
Control Content Model Smooth progression from simple to rich
12/6/ :20 AM Control Content Model Smooth progression from simple to rich Data as a first class citizen Separate presentation of content and control Example: Button.Content = “Hello”; … Button.Content = new Image(“happy.gif”); © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
11
Content Pattern Singular Content: Plural Content:
12/6/ :20 AM Content Pattern Singular Content: public object Content { get; set; } public Style ContentStyle { get; set; } Plural Content: public ItemsCollection Items { get; } public Style ItemStyle { get; set; } © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
12
The Five Control Families
Control: No Content ScrollBar ContentControl: Singular Content Button.Content ItemsControl: Plural Content ListBox.Items HeaderedItemsControl: MenuItem.Header, MenuItem.Items HeaderedContentControl: GroupBox.Header, GroupBox.Content © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
13
ContentPresenter Where Content, Style, and Control meets
12/6/ :20 AM ContentPresenter Where Content, Style, and Control meets Placeholder for Content in VisualTree © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
14
Communication Contract
12/6/ :20 AM Communication Contract Because of Control and Style separation Contract between Control and Style: Today: use IDs Later: use Commands & Properties © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
15
Close Enough To UpDown? FrameworkElement Match = RangeBase Control
ScrollBar HorizontalScrollBar VerticalScrollBar Slider HorizontalSlider VerticalSlider Match = RangeBase © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
16
Chicken And Egg Which comes first, the type definition or the markup?
12/6/ :20 AM Chicken And Egg Which comes first, the type definition or the markup? Today: type definition Later: one build step for both Types consumed in markup must be defined in a separate assembly Use directive in markup to include assembly: <?Mapping XmlNamespace=“X” … ?> Complete connection with new xmlns: xmlns:other=“X” © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
17
What UpDown Got For Free By Deriving from RangeBase
12/6/ :20 AM What UpDown Got For Free By Deriving from RangeBase Properties Minimum Maximum Value SmallChange LargeChange Events ValueChanged © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
18
What UpDown Got For Free By Deriving from Control
12/6/ :20 AM What UpDown Got For Free By Deriving from Control Styles Commands, Input, and Eventing Layout and Rendering Hit-Testing Initial Accessibility Initial Themes © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
19
Lines Of Code Comparison
12/6/ :20 AM Lines Of Code Comparison Control Win32 Longhorn % Savings Button 1906 1901 0% ScrollBar 3163 1956 38% ListBox 8176 2156 74% UpDown 1803 194 89% Same for simpler controls Dramatic saving for more advanced controls © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
20
what one customer has built Infragistics
12/6/ :20 AM DataGrid what one customer has built Infragistics © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
21
Questions To Ask Yourself
12/6/ :20 AM Questions To Ask Yourself I am about to write a new control … Can I change the style of an existing control? This only applies if you don’t need a new type What family of control am I trying to write? Which control within that family is closest to what I want? © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
22
Compose, Compose, Compose, Compose,
12/6/ :20 AM Compose, Compose, Compose, Compose, Compose © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
23
Style, Style, Style, Style,
12/6/ :20 AM Style, Style, Style, Style, Style © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
24
Homework #1 Learn about DependencyProperty How it helps: Styles
12/6/ :20 AM Homework #1 Learn about DependencyProperty How it helps: Styles Animations Databinding Overall Declarative Model © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
25
Homework #2 Feedback Eval form
12/6/ :20 AM Homework #2 Feedback Eval form Write a control and with bumps along the way © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
26
Community Resources Get your questions answered!
12/6/ :20 AM Community Resources Get your questions answered! Newsgroups microsoft.public.windows.developer.winfx.avalon Longhorn DevCenter Client Track Lounge - Concourse Foyer connect with Microsoft client product teams and PDC 2003 Speakers Ask The Experts Tuesday 7 pm – 9 pm in Hall G,H PDC Weblogs © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
27
© 2003-2004 Microsoft Corporation. All rights reserved.
12/6/ :20 AM © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary. © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
28
12/6/ :20 AM © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.