#MIX08 Session: Creating Rich, Dynamic User Interfaces with Silverlight 2

Karen Corby

NB: Code will be posted on Karen's blog

  • User control, motivations
    • Re-use
    • Modularization
    • Encapsulation
  • Same concept as in WPF
  • No more need for "InitializeFromXaml()", good news. The "XAML hook" is done for us by the framework
  • KeyDown Event can now be handled on any component level, not just the application level like before
  • Databinding in Silverlight, how much sweeter can it get. Can't wait to play with it... Wondering how well the MVVM pattern can be used in Silverlight.
  • Oh yeah, flow layout is probably even sweeter than databinding.
  • Accessibility of controls
    • Keyboard tab, focus, directional navigation
    • Screen reader support based on UIAutomation (check Mark Rideout's videos)
  • Custom Control, motivations
    • Separate the visual from the logic
    • For default L&F
      • add generic.xaml file
      • set BuildAction to Resource
      • remove CustomTool build action
      • add ResourceDictionary with default L&F for the Custom control.
  • Styling
    • Tweek minor visual characteristics
    • Major difference to WPF: Styles can only be written once.
    • Other difference: Application level styles not supported ("global styles")
    • No "BasedOn" styles for the moment
    • No support for triggers in SL 2, maybe later
  • Skinning
    • Replaces the look of the control
    • No big difference to WPF
  • DependencyProperties available in Silverlight (obviously)
  • Parts model:
    • How to structure your controls
    • Keep clear separation between logic and visuals
    • Explicit contract about how logic and visuals interact
    • It's a recommended pattern, but not enforced by the framework
    • Will be supported by Blend 2.5
    • Element Part
      • For example Scrollbar's UpButton, DownButton, Thumb, Track
    • State Part
      • Stroyboard
      • Defines transitions between control's states
      • Control logic defines state machine starting and stopping the storyboards
    • TemplatePart attribute for the Control class
    • Parts are defined in the ControlTemplate
    • Not everything in the ControlTemplate needs to be a Part
    • OnApplyTemplate overriden in the control's code behind
    • Use GetTemplateChild method to get the various parts inside the ControlTemplate
    • Control logic handles the state transition
    • This model will transition back to WPF eventually
  • Directional Navigation
    • Uses HitTest API to determine the target control
    • Allows using keyboard arrows to navigate between controls (not just using tabs)
  • DynamicResource not supported in SL2
Print | posted on Thursday, March 06, 2008 7:16 AM

Feedback

No comments posted yet.
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: