Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Welcome!<br />AppDev’s<br />Silverlight 4 for Visual Studio 2010 Using Visual Basic<br />Instructor: Bill Hatfield<br />Co...
Introducing Silverlight 4!<br />Copyright 2010, AppDev Products, LLC.    All Rights Reserved.<br />
Objectives<br />Introduce Silverlight<br />Investigate XAML and the XAML designer in Visual Studio 2010<br />Learn about X...
Agenda<br />Introducing Silverlight<br />Introducing XAML and the Silverlight Designer<br />Investigating XAML<br />Introd...
Introducing Silverlight<br />Cross-browser, cross-platform plug-in<br />Create rich interactive applications (RIAs) for th...
Copyright 2010, AppDev Products, LLC.    All Rights Reserved.<br />Why Silverlight?<br />Delivers the best of both worlds:...
Why Silverlight?<br />Beyond HTML<br />Keeps users engaged <br />Combines animation, video, vector graphics, perspective 3...
Why Silverlight?<br />Highest quality media<br />Up to 1080p true HD-quality video<br />Uses H.264 (MP4) or WMV with Smoot...
Evolution of Silverlight<br />Silverlight 1<br />Support for scripting languages only<br />Interesting layout capabilities...
Silverlight 3<br />Navigation Framework<br />Build apps with multiple pages<br />Navigation via links<br />More controls a...
Silverlight 4<br />Printing support<br />Several new controls, including DataGrid<br />Enhanced data binding, including dr...
Silverlight Development Tools<br />Visual Studio 2008 (Silverlight 3)<br />Download the Silverlight 3 Toolkit<br />No visu...
Getting Started<br />Verify that Silverlight has been installed<br />Navigate to:<br />http://www.microsoft.com/silverligh...
Getting Started<br />Build Silverlight solutions in Visual Studio<br />Suggestion: <br />Consider using Expression Blend f...
WPF vs. Silverlight<br />Microsoft provides two technologies for client-side applications: WPF and Silverlight<br />Both a...
WPF vs. Silverlight<br />WPF:<br />Ships as part of .NET Framework (3.0 and later)<br />Runs only on Windows (XP or better...
WPF vs. Silverlight<br />Silverlight:<br />Ships independently; isn’t part of .NET Framework<br />Is typically hosted in a...
An Inconvenient Truth (or Two)<br />Far more difficult to create a decent-looking application in XAML<br />Because the bar...
Silverlight and XAML<br />Silverlight and XAML: The same thing?<br />XAML is XML-based grammar that can be used to declara...
Agenda<br />Introducing Silverlight<br />Introducing XAML and the Silverlight Designer<br />Investigating XAML<br />Introd...
Introducing XAML<br />Build Silverlight solutions in Visual Studio<br />Use Expression Blend for sophisticated styling, te...
Additional Silverlight 4 Projects<br />Silverlight 4 adds more project types:<br />Silverlight Business Application<br />I...
Your First Silverlight Application<br />Pages 1-8 to 1-10<br />Copyright 2010, AppDev Products, LLC.    All Rights Reserve...
Agenda<br />Introducing Silverlight<br />Introducing XAML and the Silverlight Designer<br />Investigating XAML<br />Introd...
Investigating XAML<br />XAML is simple<br />But provides several different ways to set property values<br />Simple Propert...
Simple Properties/Type Converters<br />Dragging Button control onto design surface creates several properties<br />Markup ...
Type Converters<br />Height and Width properties?<br />Properties are numeric<br />Markup supplies values as strings<br />...
Type Converters<br />Margin adds own set of issues<br />Can supply a single value (all four sides)<br />Can supply two val...
Complex Properties<br />Type converters work well<br />Some properties can’t be represented by single value<br />Want to s...
DEMO<br />Page 1-22: Complex Properties, Try It Out!<br />Copyright 2010, AppDev Products, LLC.    All Rights Reserved.<br />
Markup Extensions<br />Usually, standard XAML markup provides functionality you need<br />Sometimes not possible to set pr...
Markup Extensions<br />Declarative binding requires markup extension:<br />Can also express using child element:<br />Copy...
DEMO<br />Markup extension/binding<br />Copyright 2010, AppDev Products, LLC.    All Rights Reserved.<br />
Attached Properties<br />Nest a control within a Grid<br />Specify its row and column with Grid.Row and Grid.Column proper...
Attached Properties<br />Specific syntax:<br />DefiningType.PropertyName<br />Grid.Row<br />Aren't actually properties<br ...
Attached Properties<br />Of course, Grid doesn't keep track of all its children's coordinates<br />Child controls all inhe...
Attached Properties<br />Calling parent control's GetPropertyName and SetPropertyNamemethods equivalent to calling GetValu...
Agenda<br />Introducing Silverlight<br />Introducing XAML and the Silverlight Designer<br />Investigating XAML<br />Introd...
Content and Grid Controls<br />Many controls inherit from ContentControl (including Button) and can contain other controls...
Working with Layout Controls<br />Several controls useful for laying out other controls<br />DockPanel<br />Allocates an e...
Working with Layout Controls<br />Grid<br />Arranges children in a grid<br />No need for fixed sizes or positions<br />Res...
List Box as Container<br />DEMO<br />Copyright 2010, AppDev Products, LLC.    All Rights Reserved.<br />
Working with the Grid Control<br />DEMO<br />Copyright 2010, AppDev Products, LLC.    All Rights Reserved.<br />
Dependency Properties<br />In standard .NET code, property is defined using two procedures<br />“setter” and “getter”<br /...
DependencyObject Class<br />DependencyProperty class acts as base for the properties<br />DependencyObject is base for cla...
Investigating DependencyProperty<br />.NET maintains internal dictionary of classes and the properties they expose<br />De...
Declaring the Property<br />Copyright 2010, AppDev Products, LLC.    All Rights Reserved.<br />VB: Public Shared IsAvailab...
In Constructor<br />Copyright 2010, AppDev Products, LLC.    All Rights Reserved.<br />[Visual Basic]<br />MyClass.IsAvail...
Property Wrapper<br />Copyright 2010, AppDev Products, LLC.    All Rights Reserved.<br />[Visual Basic]<br />Public Proper...
Property Wrapper<br />Copyright 2010, AppDev Products, LLC.    All Rights Reserved.<br />[C#]<br />public bool IsAvailable...
Using Attached Properties<br />Button control doesn’t expose Grid.Column or Grid.Row<br />Yet these attributes exist in th...
Working with Attached Properties<br />Copyright 2010, AppDev Products, LLC.    All Rights Reserved.<br />[Visual Basic]<br...
Interacting with the Grid<br />Add code to move button to new row<br />Copyright 2010, AppDev Products, LLC.    All Rights...
Running Out of Browser<br />Silverlight applications distributed through browser<br />But applications can be run locally:...
Running Out of Browser<br />DEMO<br />Copyright 2010, AppDev Products, LLC.    All Rights Reserved.<br />
Upcoming SlideShare
Loading in …5
×

Silverlight Chapter 01 - Introduction

793 views

Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Silverlight Chapter 01 - Introduction

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

×