Click or drag to resize

BindingRelay Class

A simple helper to relay the data context to objects that don't live in the visual tree.
Inheritance Hierarchy

Namespace: TomsToolbox.Wpf
Assembly: TomsToolbox.Wpf (in TomsToolbox.Wpf.dll) Version: 2.21.0+44d18b541fc9419ec3c549350a832394661b2a4d
XMLNS for XAML: Not mapped to an xmlns.
Syntax
public class BindingRelay : Freezable

The BindingRelay type exposes the following members.

Constructors
 NameDescription
Public methodBindingRelayInitializes a new instance of the BindingRelay class
Top
Properties
 NameDescription
Public propertyDataContext Gets or sets the data to be relayed, usually the DataContext of the owning object.
Top
Methods
 NameDescription
Protected methodCreateInstanceCore When implemented in a derived class, creates a new instance of the Freezable derived class.
(Overrides FreezableCreateInstanceCore)
Top
Fields
 NameDescription
Public fieldStatic memberDataContextProperty Identifies the DataContext dependency property.
Top
Extension Methods
 NameDescription
Public Extension MethodAncestors Returns an enumeration of the ancestor elements in the logical tree of this element.
(Defined by DependencyObjectExtensions)
Public Extension MethodAncestorsAndSelf Returns an enumeration of elements that contain this element, and the ancestors in the logical tree of this element.
(Defined by DependencyObjectExtensions)
Public Extension MethodGetExportProvider Gets the active export provider for the specified object.
(Defined by ExportProviderLocator)
Public Extension MethodGetMissingExportProviderMessage Gets the message to show when an export provider could not be located in the visual tree.
(Defined by ExportProviderLocator)
Public Extension MethodGetRootVisual Gets the root visual for the item.
(Defined by DependencyObjectExtensions)
Public Extension MethodGetValueT Gets the value of a dependency property using SafeCastT(Object).
(Defined by DependencyObjectExtensions)
Public Extension MethodGetWindowHandle Gets the window handle of the HwndSource hosting this item.
(Defined by DependencyObjectExtensions)
Public Extension MethodSafeCastT Performs a cast from object to T, avoiding possible null violations if T is a value type.
(Defined by ObjectExtensions)
Public Extension MethodSetExportProvider Sets the export provider.
(Defined by ExportProviderLocator)
Public Extension MethodTryFindAncestorT Returns the first element in the ancestor list that implements the type of the type parameter.
(Defined by DependencyObjectExtensions)
Public Extension MethodTryFindAncestorT Returns the first element in the ancestor list that implements the type of the type parameter.
(Defined by DependencyObjectExtensions)
Public Extension MethodTryFindAncestorOrSelfT Returns the first element in the ancestor list that implements the type of the type parameter.
(Defined by DependencyObjectExtensions)
Public Extension MethodTryFindAncestorOrSelfT Returns the first element in the ancestor list that implements the type of the type parameter.
(Defined by DependencyObjectExtensions)
Public Extension MethodTryGetExportProvider Gets the active export provider for the specified object, or null if no export provider is registered.
(Defined by ExportProviderLocator)
Public Extension MethodTryGetRootVisual Gets the root visual for the item.
(Defined by DependencyObjectExtensions)
Public Extension MethodVisualAncestors Returns an enumeration of the ancestor elements in the visual tree of this element.
(Defined by DependencyObjectExtensions)
Public Extension MethodVisualAncestorsAndSelf Returns an enumeration of elements that contains this element, and the ancestors in the visual tree of this element.
(Defined by DependencyObjectExtensions)
Public Extension MethodVisualChildren Enumerates the immediate children of the specified item.
(Defined by DependencyObjectExtensions)
Public Extension MethodVisualChildrenAndSelf Enumerates the specified item and it's immediate children.
(Defined by DependencyObjectExtensions)
Public Extension MethodVisualDescendants Enumerates all visuals descendants of the specified item.
(Defined by DependencyObjectExtensions)
Public Extension MethodVisualDescendantsAndSelf Enumerates the specified item and all it's visual descendants.
(Defined by DependencyObjectExtensions)
Top
Example
XAML
<DataGrid>
  <DataGrid.Resources>
    <local:BindingRelay x:Key="relay" DataContext="{Binding}"/>
  </DataGrid.Resources>
  <DataGrid.Columns>
    <DataGridTextColumn Visibility="{Binding DataContext.MyColumnVisibility, Source={StaticResource relay}}"/>
  </DataGrid.Columns>
</DataGrid>
See Also