Binding to DataContext[DC]

  • A DependencyProperty defined in FrameworkElement which supports containment inheritance in the visual hierarchy
  • For ItemsControl bound to a collection source, individual element's DC is automatically set as single item of collection
    {Binding}: binds directly to DC.
    {Binding Path="P1"}: binds to property P1 in the DC.
    {Binding Path="P2.P1"}: binds to P1 property of P2 in DC
    

Resources

  • Identified by unique key, implicit or explicit [x:Key directive].
  • Can be created/overwritten in the Resources section for a FrameworkElement/FrameworkContentElement or Application. Can also be defined in Resource Dictionaries and merged with Application resources.
  • Recommended creation at the minimum level possible.
  • Binding.Source uses them with ...

Get MVVM Survival Guide for Enterprise Architectures in Silverlight and WPF now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.