SlideShare a Scribd company logo
Welcome! AppDev’s Silverlight 4 for Visual Studio 2010 Using Visual Basic Instructor: Bill Hatfield Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Introducing Silverlight 4! Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Objectives Introduce Silverlight Investigate XAML and the XAML designer in Visual Studio 2010 Learn about XAML controls, properties, and events Work with container controls, dependency properties, and the Grid control Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Agenda Introducing Silverlight Introducing XAML and the Silverlight Designer Investigating XAML Introducing Content and Grid Controls Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Introducing Silverlight Cross-browser, cross-platform plug-in Create rich interactive applications (RIAs) for the Web Originally seen as a competitor to Flash  Lightweight runtime (under 5 MB) Based on XAML Quick demonstration: http://www.microsoft.com/silverlight Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Copyright 2010, AppDev Products, LLC.    All Rights Reserved. Why Silverlight? Delivers the best of both worlds: Leverages .NET Framework Creates rich Internet experiences Provides class library support for rapid development
Why Silverlight? Beyond HTML Keeps users engaged  Combines animation, video, vector graphics, perspective 3D, effects, features like Deep Zoom Fastest Web Experiences Put any CPU to work Multi-threading support Tap into 100+ Controls Silverlight allows you to skin controls using mark-up Easier to have controls fit your task or brand Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Why Silverlight? Highest quality media Up to 1080p true HD-quality video Uses H.264 (MP4) or WMV with Smooth Streaming Mac, Windows, and Linux Works with every major operating system All major browsers Go out of Browser Can install applications on desktop Run apps seamlessly without connectivity Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Evolution of Silverlight Silverlight 1 Support for scripting languages only Interesting layout capabilities Great for streaming videos Silverlight 2 Support for .NET Framework and CLR Data binding Isolated storage Support for calling services Cross-domain network access Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Silverlight 3 Navigation Framework Build apps with multiple pages Navigation via links More controls and layout capabilities Modal windows Element-to-element binding Data validation Ability to run outside the browser Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Silverlight 4 Printing support Several new controls, including DataGrid Enhanced data binding, including drag and drop “Toast” notification windows Offline DRM For trusted applications COM Interop Reading/writing user’s special folders New interface for requesting application privileges Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Silverlight Development Tools Visual Studio 2008 (Silverlight 3) Download the Silverlight 3 Toolkit No visual designer Visual Studio 2010 (Silverlight 3 or 4) Build Silverlight applications out of the box Full tooling Download Silverlight 4 Expression Blend 3 (and now 4!) Powerful tool for building layout, animation, effects Bit of a learning curve (made for designers) Not free, but included in MSDN subscriptions Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Getting Started Verify that Silverlight has been installed Navigate to: http://www.microsoft.com/silverlight/get-started/install/default.aspx Can also use Control Panel to verify version Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Getting Started Build Silverlight solutions in Visual Studio Suggestion:  Consider using Expression Blend for more complex styling, templating, animations, and so on Three types of Silverlight projects Silverlight Application template creates simple application Silverlight Navigation Application template provides a jumpstart for more sophisticated multi-page  apps Silverlight Library creates DLL  Makes it easier to partition logic and features Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
WPF vs. Silverlight Microsoft provides two technologies for client-side applications: WPF and Silverlight Both allow you to create client applications Both use XAML to design the interface WPF has entire .NET Framework behind it Silverlight works with a small subset of Framework Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
WPF vs. Silverlight WPF: Ships as part of .NET Framework (3.0 and later) Runs only on Windows (XP or better) Runs as a stand-alone Windows app or as a Web Browser app (XBAP) XBAPs require the .NET Framework on the client (where the browser is running) Browser compatibility: IE only in .NET 3.0; IE and Firefox in .NET 3.5 and later Provides richest functionality Full support for 3D graphics Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
WPF vs. Silverlight Silverlight: Ships independently; isn’t part of .NET Framework Is typically hosted in a Web browser Broad browser support including IE, Firefox, Safari Cross-platform - Runs on Windows, Mac, Linux clients Provides a subset of WPF’s features And only small subset of .NET Framework Which do you use? Depends on target audience, technological needs, preferred deployment Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
An Inconvenient Truth (or Two) Far more difficult to create a decent-looking application in XAML Because the bar is so much lower in other environments Developers creating applications in XAML generally create ugly applications Good XAML applications require graphic designers On the other hand… Far easier to create great-looking application  Because Windows and Web forms are so limited  Also check out Microsoft Expression Studio Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Silverlight and XAML Silverlight and XAML: The same thing? XAML is XML-based grammar that can be used to declaratively define Silverlight applications Can also use Silverlight libraries and code the interface XAML <-> Silverlight libraries are not a one-to-one mapping Some names in used in creating a Silverlight interface in XAML don’t match exactly with the corresponding library class/collection/property names Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Agenda Introducing Silverlight Introducing XAML and the Silverlight Designer Investigating XAML Introducing Content and Grid Controls Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Introducing XAML Build Silverlight solutions in Visual Studio Use Expression Blend for sophisticated styling, templating, animations, and more Silverlight projects Silverlight Application template creates simple application Outputs XAP file, downloaded by the Silverlight runtime Silverlight Navigation Application template provides a jumpstart for multi-page apps Silverlight Library creates DLL  Makes it easier to partition logic and features Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Additional Silverlight 4 Projects Silverlight 4 adds more project types: Silverlight Business Application Includes login and membership  WCF RIA Services Class Library Focus on Silverlight Application template in this course Visual Studio 2010 doesn’t include all Silverlight controls Download Silverlight Toolkit to get the rest http://www.codeplex.com/Silverlight Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Your First Silverlight Application Pages 1-8 to 1-10 Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Agenda Introducing Silverlight Introducing XAML and the Silverlight Designer Investigating XAML Introducing Content and Grid Controls Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Investigating XAML XAML is simple But provides several different ways to set property values Simple Properties/Type Converters Complex Properties Markup Extensions Attached Properties Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Simple Properties/Type Converters Dragging Button control onto design surface creates several properties Markup counts on Button class providing Content, Height, HorizontalAlignment, Margin, Name, VerticalAlignment, and Width properties Some properties are simple strings Content and Name properties Others are more complex Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Type Converters Height and Width properties? Properties are numeric Markup supplies values as strings Along the line, some code must convert Works because Integer class provides built-in conversion from string Other properties even more complex: HorizontalAlignment and VerticalAlignment? Need to convert from string (Bottom, Center, Stretch, or Top; Center, Left, Right, Stretch) to enumerated values Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Type Converters Margin adds own set of issues Can supply a single value (all four sides) Can supply two values (left/right and top/bottom) Can supply four values (left, top, right, bottom) Margin property is a Thickness structure Contains four integers Setting property calls constructor for Thickness structure Requires converter to read the comma-delimited string and convert to a call to the constructor Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Complex Properties Type converters work well Some properties can’t be represented by single value Want to specify background of a Grid control as a linear gradient? Can’t represent the behavior with a single value Properties of elements that are themselves objects with properties require special care Represent as nested elements  Named Parent.Property (Grid.Background) Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
DEMO Page 1-22: Complex Properties, Try It Out! Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Markup Extensions Usually, standard XAML markup provides functionality you need Sometimes not possible to set property value at design time Some properties must be set dynamically, at runtime Need to use markup extension Allows you to set property in non-standard way Can specify markup extension as nested element, or as attribute As attribute, always surrounded with {  } Indicating value supplied at runtime Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Markup Extensions Declarative binding requires markup extension: Can also express using child element: Copyright 2010, AppDev Products, LLC.    All Rights Reserved. Property=  "{Binding ElementName=ObjectName,             Path="PropertyName}" <Object.Property>   <Binding ElementName="ObjectName",            Path=PropertyName"/> </Object.Property>
DEMO Markup extension/binding Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Attached Properties Nest a control within a Grid Specify its row and column with Grid.Row and Grid.Column properties Where did these come from?  Child control doesn't supply! Grid adds these to all its child controls In other words, they're attached properties Properties appear as properties of the class But they're defined in a different class (Grid, in this case) Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Attached Properties Specific syntax: DefiningType.PropertyName Grid.Row Aren't actually properties Converted to method calls by compiler Defining class must provide GetPropertyName and SetPropertyName methods Grid.GetRow and Grid.SetRow Technique hides what's really going on Calling method in defining class? Does Grid keep track of all its children's coordinates? Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Attached Properties Of course, Grid doesn't keep track of all its children's coordinates Child controls all inherit from DependencyObject Defined to maintain an unlimited number of dependency properties Parent (Grid) maintains a single instance of a field for each property Grid.RowProperty for Grid.Row, for example Child maintains its own value for that property Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Attached Properties Calling parent control's GetPropertyName and SetPropertyNamemethods equivalent to calling GetValue and SetValue methods of child object To retrieve Grid.Row property of TextBox named DemoTextBox, use expression like: Copyright 2010, AppDev Products, LLC.    All Rights Reserved. DemoTextBox.GetValue(Grid.RowProperty)
Agenda Introducing Silverlight Introducing XAML and the Silverlight Designer Investigating XAML Introducing Content and Grid Controls Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Content and Grid Controls Many controls inherit from ContentControl (including Button) and can contain other controls Button with image and text?  No problem! ListBox containing a bunch of TextBox controls?  No problem! Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Working with Layout Controls Several controls useful for laying out other controls DockPanel Allocates an edge for each child control Useful for defining rough layout StackPanel Stacks children horizontally or vertically Useful internal to other controls (Button, for example) Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Working with Layout Controls Grid Arranges children in a grid No need for fixed sizes or positions Rescales when resized Canvas No layout logic Manually control each aspect of layout Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
List Box as Container DEMO Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Working with the Grid Control DEMO Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Dependency Properties In standard .NET code, property is defined using two procedures “setter” and “getter” More complex mechanism here Workflow uses same mechanism Dependency properties allow for: Styling Automatic data binding Animation Change notification and more… Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
DependencyObject Class DependencyProperty class acts as base for the properties DependencyObject is base for classes that can consume and expose dependency properties XAML classes expose far more properties than the corresponding prior classes Need some internal plumbing to handle Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Investigating DependencyProperty .NET maintains internal dictionary of classes and the properties they expose DependencyProperty instance defined as a static/shared member of a class In constructor, code registers property, its type, and hosting class with .NET Can optionally create standard .NET property that wraps up the dependency property Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Declaring the Property Copyright 2010, AppDev Products, LLC.    All Rights Reserved. VB: Public Shared IsAvailableProperty As DependencyProperty C#: public static DependencyProperty IsAvailableProperty;
In Constructor Copyright 2010, AppDev Products, LLC.    All Rights Reserved. [Visual Basic] MyClass.IsAvailableProperty = _    DependencyProperty.Register("IsAvailable", _    GetType(Boolean), GetType(MyClass)) [C#] MyClass.IsAvailableProperty =   DependencyProperty.Register("IsAvailable",   typeof(bool), typeof(MyClass))
Property Wrapper Copyright 2010, AppDev Products, LLC.    All Rights Reserved. [Visual Basic] Public Property IsAvailable() As Boolean  Get    Return _    CType(GetValue(MyClass.IsAvailableProperty), Boolean)  End Get  Set(ByVal value As Boolean)    SetValue(MyClass.IsAvailableProperty, value)  End SetEnd Property
Property Wrapper Copyright 2010, AppDev Products, LLC.    All Rights Reserved. [C#] public bool IsAvailable{  get {     return (bool) GetValue(MyClass.IsAvailableProperty); }  set { SetValue(MyClass.IsAvailableProperty, value) }}
Using Attached Properties Button control doesn’t expose Grid.Column or Grid.Row Yet these attributes exist in the XAML markup These are attached properties Properties added by container, when hosted Retrieve and set using DependencyObject.GetValue and DependencyObject.SetValue Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Working with Attached Properties Copyright 2010, AppDev Products, LLC.    All Rights Reserved. [Visual Basic] Dim row As Integer =   CType(DemoButton.GetValue(Grid.RowProperty), Integer) DemoButton.SetValue(Grid.RowProperty, row + 1)  [C#] int row = (int)DemoButton.GetValue(Grid.RowProperty); DemoButton.SetValue(Grid.RowProperty, row + 1);
Interacting with the Grid Add code to move button to new row Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Running Out of Browser Silverlight applications distributed through browser But applications can be run locally: no connection! Even when run locally Silverlight apps use only small subset of .NET Framework Apps are still sandboxed Can’t do anything destructive unless granted permission explicitly No connectivity required Simple to install and uninstall Copyright 2010, AppDev Products, LLC.    All Rights Reserved.
Running Out of Browser DEMO Copyright 2010, AppDev Products, LLC.    All Rights Reserved.

More Related Content

What's hot

IBM WebSphere Portal References Education
IBM WebSphere Portal References EducationIBM WebSphere Portal References Education
IBM WebSphere Portal References Education
Dvir Reznik
 
Flex3
Flex3Flex3
Flex3
SaurabhIT
 
Adobe AIR Programming to Desktop and Mobile
Adobe AIR Programming to Desktop and MobileAdobe AIR Programming to Desktop and Mobile
Adobe AIR Programming to Desktop and Mobile
Pasi Manninen
 
Adobe's RIA Technologies (non technical)
Adobe's RIA Technologies (non technical)Adobe's RIA Technologies (non technical)
Adobe's RIA Technologies (non technical)
Cyril Hanquez
 
Beginners introduction to asp.net
Beginners introduction to asp.netBeginners introduction to asp.net
Beginners introduction to asp.net
Naveen Kumar Veligeti
 
Max 2010: Having Fun Flex4 Layouts
Max 2010: Having Fun Flex4 LayoutsMax 2010: Having Fun Flex4 Layouts
Max 2010: Having Fun Flex4 Layouts
Xavi Beumala
 
Enrique Duvos: Adobe RIA Platform
Enrique Duvos: Adobe RIA PlatformEnrique Duvos: Adobe RIA Platform
Enrique Duvos: Adobe RIA Platform
Initium
 
Real World SharePoint Framework and Azure Services
Real World SharePoint Framework and Azure ServicesReal World SharePoint Framework and Azure Services
Real World SharePoint Framework and Azure Services
Brian Culver
 
Uncovering the Latest in SharePoint Development
Uncovering the Latest in SharePoint DevelopmentUncovering the Latest in SharePoint Development
Uncovering the Latest in SharePoint Development
Eric Overfield
 
MSDN Unleashed: WPF Demystified
MSDN Unleashed: WPF DemystifiedMSDN Unleashed: WPF Demystified
MSDN Unleashed: WPF Demystified
Dave Bost
 
SPCA2013 - Building Windows Client Applications for SharePoint 2013
SPCA2013 - Building Windows Client Applications for SharePoint 2013SPCA2013 - Building Windows Client Applications for SharePoint 2013
SPCA2013 - Building Windows Client Applications for SharePoint 2013
NCCOMMS
 
Move past bootstrap and build our lightweight responsive framework w.v1.2
Move past bootstrap and build our lightweight responsive framework w.v1.2Move past bootstrap and build our lightweight responsive framework w.v1.2
Move past bootstrap and build our lightweight responsive framework w.v1.2
Eric Overfield
 
IBM WebSphere Portal
IBM WebSphere PortalIBM WebSphere Portal
IBM WebSphere Portal
Vincent Perrin
 
Flex And Ria
Flex And RiaFlex And Ria
Flex And Ria
ravinxg
 
Moving to Microsoft Visual Basic .NET
Moving to Microsoft Visual Basic .NETMoving to Microsoft Visual Basic .NET
Moving to Microsoft Visual Basic .NET
V Sanchez
 
Hello Gumbo
Hello GumboHello Gumbo
Hello Gumbo
Xavi Beumala
 
San Francisco PHP Meetup Presentation on Zend Framework
San Francisco PHP Meetup Presentation on Zend FrameworkSan Francisco PHP Meetup Presentation on Zend Framework
San Francisco PHP Meetup Presentation on Zend Framework
zend
 
Developing service component architecture applications using rational applica...
Developing service component architecture applications using rational applica...Developing service component architecture applications using rational applica...
Developing service component architecture applications using rational applica...
Bill Duncan
 
WebSphere Portal Business Overview
WebSphere Portal Business OverviewWebSphere Portal Business Overview
WebSphere Portal Business Overview
Joel Demay
 

What's hot (19)

IBM WebSphere Portal References Education
IBM WebSphere Portal References EducationIBM WebSphere Portal References Education
IBM WebSphere Portal References Education
 
Flex3
Flex3Flex3
Flex3
 
Adobe AIR Programming to Desktop and Mobile
Adobe AIR Programming to Desktop and MobileAdobe AIR Programming to Desktop and Mobile
Adobe AIR Programming to Desktop and Mobile
 
Adobe's RIA Technologies (non technical)
Adobe's RIA Technologies (non technical)Adobe's RIA Technologies (non technical)
Adobe's RIA Technologies (non technical)
 
Beginners introduction to asp.net
Beginners introduction to asp.netBeginners introduction to asp.net
Beginners introduction to asp.net
 
Max 2010: Having Fun Flex4 Layouts
Max 2010: Having Fun Flex4 LayoutsMax 2010: Having Fun Flex4 Layouts
Max 2010: Having Fun Flex4 Layouts
 
Enrique Duvos: Adobe RIA Platform
Enrique Duvos: Adobe RIA PlatformEnrique Duvos: Adobe RIA Platform
Enrique Duvos: Adobe RIA Platform
 
Real World SharePoint Framework and Azure Services
Real World SharePoint Framework and Azure ServicesReal World SharePoint Framework and Azure Services
Real World SharePoint Framework and Azure Services
 
Uncovering the Latest in SharePoint Development
Uncovering the Latest in SharePoint DevelopmentUncovering the Latest in SharePoint Development
Uncovering the Latest in SharePoint Development
 
MSDN Unleashed: WPF Demystified
MSDN Unleashed: WPF DemystifiedMSDN Unleashed: WPF Demystified
MSDN Unleashed: WPF Demystified
 
SPCA2013 - Building Windows Client Applications for SharePoint 2013
SPCA2013 - Building Windows Client Applications for SharePoint 2013SPCA2013 - Building Windows Client Applications for SharePoint 2013
SPCA2013 - Building Windows Client Applications for SharePoint 2013
 
Move past bootstrap and build our lightweight responsive framework w.v1.2
Move past bootstrap and build our lightweight responsive framework w.v1.2Move past bootstrap and build our lightweight responsive framework w.v1.2
Move past bootstrap and build our lightweight responsive framework w.v1.2
 
IBM WebSphere Portal
IBM WebSphere PortalIBM WebSphere Portal
IBM WebSphere Portal
 
Flex And Ria
Flex And RiaFlex And Ria
Flex And Ria
 
Moving to Microsoft Visual Basic .NET
Moving to Microsoft Visual Basic .NETMoving to Microsoft Visual Basic .NET
Moving to Microsoft Visual Basic .NET
 
Hello Gumbo
Hello GumboHello Gumbo
Hello Gumbo
 
San Francisco PHP Meetup Presentation on Zend Framework
San Francisco PHP Meetup Presentation on Zend FrameworkSan Francisco PHP Meetup Presentation on Zend Framework
San Francisco PHP Meetup Presentation on Zend Framework
 
Developing service component architecture applications using rational applica...
Developing service component architecture applications using rational applica...Developing service component architecture applications using rational applica...
Developing service component architecture applications using rational applica...
 
WebSphere Portal Business Overview
WebSphere Portal Business OverviewWebSphere Portal Business Overview
WebSphere Portal Business Overview
 

Similar to Silverlight Chapter 01 - Introduction

Silverlight
SilverlightSilverlight
Silverlight
Tamer Elshahat
 
Uncovering Windows - Silverlight Seminar
Uncovering Windows - Silverlight SeminarUncovering Windows - Silverlight Seminar
Uncovering Windows - Silverlight Seminar
Abram John Limpin
 
Tech Lunch 9 25 2008
Tech Lunch 9 25 2008Tech Lunch 9 25 2008
Tech Lunch 9 25 2008
rothacr
 
Adobe is from Mars, Microsoft is from Uranus. A look at two competing web st...
Adobe is from Mars, Microsoft is from Uranus.  A look at two competing web st...Adobe is from Mars, Microsoft is from Uranus.  A look at two competing web st...
Adobe is from Mars, Microsoft is from Uranus. A look at two competing web st...
Eric Fickes
 
Introduction to silverlight control 4
Introduction to silverlight control 4Introduction to silverlight control 4
Introduction to silverlight control 4
msarangam
 
Introduction to silverlight
Introduction to silverlightIntroduction to silverlight
Introduction to silverlight
msarangam
 
Silver Light for every one by Subodh
Silver Light for every one by SubodhSilver Light for every one by Subodh
Silver Light for every one by Subodh
Subodh Pushpak
 
It's Time for Silverlight @iRajLal
It's Time for Silverlight @iRajLalIt's Time for Silverlight @iRajLal
It's Time for Silverlight @iRajLal
Raj Lal
 
Session 2 - Silverlight Streaming, and Windows Live Search
Session 2 - Silverlight Streaming, and Windows Live SearchSession 2 - Silverlight Streaming, and Windows Live Search
Session 2 - Silverlight Streaming, and Windows Live Search
ukdpe
 
What is Adobe Flex ?
What is Adobe Flex  ?What is Adobe Flex  ?
What is Adobe Flex ?
Antonio Correia
 
Flex Remoting With WebORB v1.0
Flex Remoting With WebORB v1.0Flex Remoting With WebORB v1.0
Flex Remoting With WebORB v1.0
guest642dd3
 
Introduction to Microsoft Silverlight
Introduction to Microsoft SilverlightIntroduction to Microsoft Silverlight
Introduction to Microsoft Silverlight
Glen Gordon
 
Developing RIAs... 10 reasons to use Adobe Flex
Developing RIAs... 10 reasons to use Adobe FlexDeveloping RIAs... 10 reasons to use Adobe Flex
Developing RIAs... 10 reasons to use Adobe Flex
Matthias Zeller
 
Silverlight Briefing Deck
Silverlight  Briefing  DeckSilverlight  Briefing  Deck
Silverlight Briefing Deck
llangit
 
Re-use Your Skills and Code to Expand the Reach of Your Apps with Silverlight
Re-use Your Skills and Code to Expand the Reach of Your Apps with SilverlightRe-use Your Skills and Code to Expand the Reach of Your Apps with Silverlight
Re-use Your Skills and Code to Expand the Reach of Your Apps with Silverlight
Frank La Vigne
 
Silverlight Training
Silverlight TrainingSilverlight Training
Silverlight Training
Subodh Pushpak
 
Parallel minds silverlight
Parallel minds silverlightParallel minds silverlight
Parallel minds silverlight
parallelminder
 
Flex RIA
Flex RIAFlex RIA
Flex RIA
rssharma
 
Silverlight
SilverlightSilverlight
Silverlight
Murtaza Abbas
 
PHP and Silverlight
PHP and SilverlightPHP and Silverlight
PHP and Silverlight
Maarten Balliauw
 

Similar to Silverlight Chapter 01 - Introduction (20)

Silverlight
SilverlightSilverlight
Silverlight
 
Uncovering Windows - Silverlight Seminar
Uncovering Windows - Silverlight SeminarUncovering Windows - Silverlight Seminar
Uncovering Windows - Silverlight Seminar
 
Tech Lunch 9 25 2008
Tech Lunch 9 25 2008Tech Lunch 9 25 2008
Tech Lunch 9 25 2008
 
Adobe is from Mars, Microsoft is from Uranus. A look at two competing web st...
Adobe is from Mars, Microsoft is from Uranus.  A look at two competing web st...Adobe is from Mars, Microsoft is from Uranus.  A look at two competing web st...
Adobe is from Mars, Microsoft is from Uranus. A look at two competing web st...
 
Introduction to silverlight control 4
Introduction to silverlight control 4Introduction to silverlight control 4
Introduction to silverlight control 4
 
Introduction to silverlight
Introduction to silverlightIntroduction to silverlight
Introduction to silverlight
 
Silver Light for every one by Subodh
Silver Light for every one by SubodhSilver Light for every one by Subodh
Silver Light for every one by Subodh
 
It's Time for Silverlight @iRajLal
It's Time for Silverlight @iRajLalIt's Time for Silverlight @iRajLal
It's Time for Silverlight @iRajLal
 
Session 2 - Silverlight Streaming, and Windows Live Search
Session 2 - Silverlight Streaming, and Windows Live SearchSession 2 - Silverlight Streaming, and Windows Live Search
Session 2 - Silverlight Streaming, and Windows Live Search
 
What is Adobe Flex ?
What is Adobe Flex  ?What is Adobe Flex  ?
What is Adobe Flex ?
 
Flex Remoting With WebORB v1.0
Flex Remoting With WebORB v1.0Flex Remoting With WebORB v1.0
Flex Remoting With WebORB v1.0
 
Introduction to Microsoft Silverlight
Introduction to Microsoft SilverlightIntroduction to Microsoft Silverlight
Introduction to Microsoft Silverlight
 
Developing RIAs... 10 reasons to use Adobe Flex
Developing RIAs... 10 reasons to use Adobe FlexDeveloping RIAs... 10 reasons to use Adobe Flex
Developing RIAs... 10 reasons to use Adobe Flex
 
Silverlight Briefing Deck
Silverlight  Briefing  DeckSilverlight  Briefing  Deck
Silverlight Briefing Deck
 
Re-use Your Skills and Code to Expand the Reach of Your Apps with Silverlight
Re-use Your Skills and Code to Expand the Reach of Your Apps with SilverlightRe-use Your Skills and Code to Expand the Reach of Your Apps with Silverlight
Re-use Your Skills and Code to Expand the Reach of Your Apps with Silverlight
 
Silverlight Training
Silverlight TrainingSilverlight Training
Silverlight Training
 
Parallel minds silverlight
Parallel minds silverlightParallel minds silverlight
Parallel minds silverlight
 
Flex RIA
Flex RIAFlex RIA
Flex RIA
 
Silverlight
SilverlightSilverlight
Silverlight
 
PHP and Silverlight
PHP and SilverlightPHP and Silverlight
PHP and Silverlight
 

Recently uploaded

Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
alexjohnson7307
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStrDeep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
saastr
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
Wouter Lemaire
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
saastr
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024
Intelisync
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 

Recently uploaded (20)

Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStrDeep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 

Silverlight Chapter 01 - Introduction

  • 1. Welcome! AppDev’s Silverlight 4 for Visual Studio 2010 Using Visual Basic Instructor: Bill Hatfield Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 2. Introducing Silverlight 4! Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 3. Objectives Introduce Silverlight Investigate XAML and the XAML designer in Visual Studio 2010 Learn about XAML controls, properties, and events Work with container controls, dependency properties, and the Grid control Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 4. Agenda Introducing Silverlight Introducing XAML and the Silverlight Designer Investigating XAML Introducing Content and Grid Controls Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 5. Introducing Silverlight Cross-browser, cross-platform plug-in Create rich interactive applications (RIAs) for the Web Originally seen as a competitor to Flash Lightweight runtime (under 5 MB) Based on XAML Quick demonstration: http://www.microsoft.com/silverlight Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 6. Copyright 2010, AppDev Products, LLC. All Rights Reserved. Why Silverlight? Delivers the best of both worlds: Leverages .NET Framework Creates rich Internet experiences Provides class library support for rapid development
  • 7. Why Silverlight? Beyond HTML Keeps users engaged Combines animation, video, vector graphics, perspective 3D, effects, features like Deep Zoom Fastest Web Experiences Put any CPU to work Multi-threading support Tap into 100+ Controls Silverlight allows you to skin controls using mark-up Easier to have controls fit your task or brand Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 8. Why Silverlight? Highest quality media Up to 1080p true HD-quality video Uses H.264 (MP4) or WMV with Smooth Streaming Mac, Windows, and Linux Works with every major operating system All major browsers Go out of Browser Can install applications on desktop Run apps seamlessly without connectivity Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 9. Evolution of Silverlight Silverlight 1 Support for scripting languages only Interesting layout capabilities Great for streaming videos Silverlight 2 Support for .NET Framework and CLR Data binding Isolated storage Support for calling services Cross-domain network access Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 10. Silverlight 3 Navigation Framework Build apps with multiple pages Navigation via links More controls and layout capabilities Modal windows Element-to-element binding Data validation Ability to run outside the browser Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 11. Silverlight 4 Printing support Several new controls, including DataGrid Enhanced data binding, including drag and drop “Toast” notification windows Offline DRM For trusted applications COM Interop Reading/writing user’s special folders New interface for requesting application privileges Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 12. Silverlight Development Tools Visual Studio 2008 (Silverlight 3) Download the Silverlight 3 Toolkit No visual designer Visual Studio 2010 (Silverlight 3 or 4) Build Silverlight applications out of the box Full tooling Download Silverlight 4 Expression Blend 3 (and now 4!) Powerful tool for building layout, animation, effects Bit of a learning curve (made for designers) Not free, but included in MSDN subscriptions Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 13. Getting Started Verify that Silverlight has been installed Navigate to: http://www.microsoft.com/silverlight/get-started/install/default.aspx Can also use Control Panel to verify version Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 14. Getting Started Build Silverlight solutions in Visual Studio Suggestion: Consider using Expression Blend for more complex styling, templating, animations, and so on Three types of Silverlight projects Silverlight Application template creates simple application Silverlight Navigation Application template provides a jumpstart for more sophisticated multi-page apps Silverlight Library creates DLL Makes it easier to partition logic and features Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 15. WPF vs. Silverlight Microsoft provides two technologies for client-side applications: WPF and Silverlight Both allow you to create client applications Both use XAML to design the interface WPF has entire .NET Framework behind it Silverlight works with a small subset of Framework Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 16. WPF vs. Silverlight WPF: Ships as part of .NET Framework (3.0 and later) Runs only on Windows (XP or better) Runs as a stand-alone Windows app or as a Web Browser app (XBAP) XBAPs require the .NET Framework on the client (where the browser is running) Browser compatibility: IE only in .NET 3.0; IE and Firefox in .NET 3.5 and later Provides richest functionality Full support for 3D graphics Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 17. WPF vs. Silverlight Silverlight: Ships independently; isn’t part of .NET Framework Is typically hosted in a Web browser Broad browser support including IE, Firefox, Safari Cross-platform - Runs on Windows, Mac, Linux clients Provides a subset of WPF’s features And only small subset of .NET Framework Which do you use? Depends on target audience, technological needs, preferred deployment Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 18. An Inconvenient Truth (or Two) Far more difficult to create a decent-looking application in XAML Because the bar is so much lower in other environments Developers creating applications in XAML generally create ugly applications Good XAML applications require graphic designers On the other hand… Far easier to create great-looking application Because Windows and Web forms are so limited Also check out Microsoft Expression Studio Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 19. Silverlight and XAML Silverlight and XAML: The same thing? XAML is XML-based grammar that can be used to declaratively define Silverlight applications Can also use Silverlight libraries and code the interface XAML <-> Silverlight libraries are not a one-to-one mapping Some names in used in creating a Silverlight interface in XAML don’t match exactly with the corresponding library class/collection/property names Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 20. Agenda Introducing Silverlight Introducing XAML and the Silverlight Designer Investigating XAML Introducing Content and Grid Controls Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 21. Introducing XAML Build Silverlight solutions in Visual Studio Use Expression Blend for sophisticated styling, templating, animations, and more Silverlight projects Silverlight Application template creates simple application Outputs XAP file, downloaded by the Silverlight runtime Silverlight Navigation Application template provides a jumpstart for multi-page apps Silverlight Library creates DLL Makes it easier to partition logic and features Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 22. Additional Silverlight 4 Projects Silverlight 4 adds more project types: Silverlight Business Application Includes login and membership WCF RIA Services Class Library Focus on Silverlight Application template in this course Visual Studio 2010 doesn’t include all Silverlight controls Download Silverlight Toolkit to get the rest http://www.codeplex.com/Silverlight Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 23. Your First Silverlight Application Pages 1-8 to 1-10 Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 24. Agenda Introducing Silverlight Introducing XAML and the Silverlight Designer Investigating XAML Introducing Content and Grid Controls Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 25. Investigating XAML XAML is simple But provides several different ways to set property values Simple Properties/Type Converters Complex Properties Markup Extensions Attached Properties Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 26. Simple Properties/Type Converters Dragging Button control onto design surface creates several properties Markup counts on Button class providing Content, Height, HorizontalAlignment, Margin, Name, VerticalAlignment, and Width properties Some properties are simple strings Content and Name properties Others are more complex Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 27. Type Converters Height and Width properties? Properties are numeric Markup supplies values as strings Along the line, some code must convert Works because Integer class provides built-in conversion from string Other properties even more complex: HorizontalAlignment and VerticalAlignment? Need to convert from string (Bottom, Center, Stretch, or Top; Center, Left, Right, Stretch) to enumerated values Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 28. Type Converters Margin adds own set of issues Can supply a single value (all four sides) Can supply two values (left/right and top/bottom) Can supply four values (left, top, right, bottom) Margin property is a Thickness structure Contains four integers Setting property calls constructor for Thickness structure Requires converter to read the comma-delimited string and convert to a call to the constructor Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 29. Complex Properties Type converters work well Some properties can’t be represented by single value Want to specify background of a Grid control as a linear gradient? Can’t represent the behavior with a single value Properties of elements that are themselves objects with properties require special care Represent as nested elements Named Parent.Property (Grid.Background) Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 30. DEMO Page 1-22: Complex Properties, Try It Out! Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 31. Markup Extensions Usually, standard XAML markup provides functionality you need Sometimes not possible to set property value at design time Some properties must be set dynamically, at runtime Need to use markup extension Allows you to set property in non-standard way Can specify markup extension as nested element, or as attribute As attribute, always surrounded with { } Indicating value supplied at runtime Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 32. Markup Extensions Declarative binding requires markup extension: Can also express using child element: Copyright 2010, AppDev Products, LLC. All Rights Reserved. Property= "{Binding ElementName=ObjectName, Path="PropertyName}" <Object.Property> <Binding ElementName="ObjectName", Path=PropertyName"/> </Object.Property>
  • 33. DEMO Markup extension/binding Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 34. Attached Properties Nest a control within a Grid Specify its row and column with Grid.Row and Grid.Column properties Where did these come from? Child control doesn't supply! Grid adds these to all its child controls In other words, they're attached properties Properties appear as properties of the class But they're defined in a different class (Grid, in this case) Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 35. Attached Properties Specific syntax: DefiningType.PropertyName Grid.Row Aren't actually properties Converted to method calls by compiler Defining class must provide GetPropertyName and SetPropertyName methods Grid.GetRow and Grid.SetRow Technique hides what's really going on Calling method in defining class? Does Grid keep track of all its children's coordinates? Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 36. Attached Properties Of course, Grid doesn't keep track of all its children's coordinates Child controls all inherit from DependencyObject Defined to maintain an unlimited number of dependency properties Parent (Grid) maintains a single instance of a field for each property Grid.RowProperty for Grid.Row, for example Child maintains its own value for that property Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 37. Attached Properties Calling parent control's GetPropertyName and SetPropertyNamemethods equivalent to calling GetValue and SetValue methods of child object To retrieve Grid.Row property of TextBox named DemoTextBox, use expression like: Copyright 2010, AppDev Products, LLC. All Rights Reserved. DemoTextBox.GetValue(Grid.RowProperty)
  • 38. Agenda Introducing Silverlight Introducing XAML and the Silverlight Designer Investigating XAML Introducing Content and Grid Controls Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 39. Content and Grid Controls Many controls inherit from ContentControl (including Button) and can contain other controls Button with image and text? No problem! ListBox containing a bunch of TextBox controls? No problem! Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 40. Working with Layout Controls Several controls useful for laying out other controls DockPanel Allocates an edge for each child control Useful for defining rough layout StackPanel Stacks children horizontally or vertically Useful internal to other controls (Button, for example) Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 41. Working with Layout Controls Grid Arranges children in a grid No need for fixed sizes or positions Rescales when resized Canvas No layout logic Manually control each aspect of layout Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 42. List Box as Container DEMO Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 43. Working with the Grid Control DEMO Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 44. Dependency Properties In standard .NET code, property is defined using two procedures “setter” and “getter” More complex mechanism here Workflow uses same mechanism Dependency properties allow for: Styling Automatic data binding Animation Change notification and more… Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 45. DependencyObject Class DependencyProperty class acts as base for the properties DependencyObject is base for classes that can consume and expose dependency properties XAML classes expose far more properties than the corresponding prior classes Need some internal plumbing to handle Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 46. Investigating DependencyProperty .NET maintains internal dictionary of classes and the properties they expose DependencyProperty instance defined as a static/shared member of a class In constructor, code registers property, its type, and hosting class with .NET Can optionally create standard .NET property that wraps up the dependency property Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 47. Declaring the Property Copyright 2010, AppDev Products, LLC. All Rights Reserved. VB: Public Shared IsAvailableProperty As DependencyProperty C#: public static DependencyProperty IsAvailableProperty;
  • 48. In Constructor Copyright 2010, AppDev Products, LLC. All Rights Reserved. [Visual Basic] MyClass.IsAvailableProperty = _ DependencyProperty.Register("IsAvailable", _ GetType(Boolean), GetType(MyClass)) [C#] MyClass.IsAvailableProperty = DependencyProperty.Register("IsAvailable", typeof(bool), typeof(MyClass))
  • 49. Property Wrapper Copyright 2010, AppDev Products, LLC. All Rights Reserved. [Visual Basic] Public Property IsAvailable() As Boolean Get Return _ CType(GetValue(MyClass.IsAvailableProperty), Boolean) End Get Set(ByVal value As Boolean) SetValue(MyClass.IsAvailableProperty, value) End SetEnd Property
  • 50. Property Wrapper Copyright 2010, AppDev Products, LLC. All Rights Reserved. [C#] public bool IsAvailable{ get { return (bool) GetValue(MyClass.IsAvailableProperty); } set { SetValue(MyClass.IsAvailableProperty, value) }}
  • 51. Using Attached Properties Button control doesn’t expose Grid.Column or Grid.Row Yet these attributes exist in the XAML markup These are attached properties Properties added by container, when hosted Retrieve and set using DependencyObject.GetValue and DependencyObject.SetValue Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 52. Working with Attached Properties Copyright 2010, AppDev Products, LLC. All Rights Reserved. [Visual Basic] Dim row As Integer = CType(DemoButton.GetValue(Grid.RowProperty), Integer) DemoButton.SetValue(Grid.RowProperty, row + 1) [C#] int row = (int)DemoButton.GetValue(Grid.RowProperty); DemoButton.SetValue(Grid.RowProperty, row + 1);
  • 53. Interacting with the Grid Add code to move button to new row Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 54. Running Out of Browser Silverlight applications distributed through browser But applications can be run locally: no connection! Even when run locally Silverlight apps use only small subset of .NET Framework Apps are still sandboxed Can’t do anything destructive unless granted permission explicitly No connectivity required Simple to install and uninstall Copyright 2010, AppDev Products, LLC. All Rights Reserved.
  • 55. Running Out of Browser DEMO Copyright 2010, AppDev Products, LLC. All Rights Reserved.