BindingOperations.DisconnectedSource Property

.NET Framework 4.5

Gets an object that replaces the DataContext when an item container is removed from the visual tree.

Namespace:  System.Windows.Data
Assembly:  PresentationFramework (in PresentationFramework.dll)

'Declaration
Public Shared ReadOnly Property DisconnectedSource As Object

Property Value

Type: System.Object
An object that replaces the DataContext when an item container is removed from the visual tree.

Use this property if you need to deal with the DataContext of an item container. An item container is the UI element that displays an item in an ItemsControl. When an ItemsControl is data bound to a collection, an item container is generated for each item. In some cases, item containers are removed from the visual tree. Two typical cases where an item container is removed are when an item is removed from the underlying collection and when virtualization is enabled on the ItemsControl. In these cases, the DataContext property of the item container will be set to the DisconnectedSource property You should check whether the DataContext is equal to the DisconnectedSource before accessing the DataContext in the DataContextChanged event for item containers. For more information about item containers and virtualization, see the remarks in the VirtualizingStackPanel class.

.NET Framework

Supported in: 4.6
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft