Forward Binding i.e. reapply a binding

Lars Larsson 31 Reputation points
2023-09-27T17:51:57.8433333+00:00

Is it possible to create an attached property containing a Binding/BindingBase & then apply it to a control i.e. forward a binding thru XAML.

Example would be you can have global style that use attached properties & then local styles to set them or retrieve from parents. Example would be to control IsExpanded in DataGrid GroupItem by expressing the "binding" somewhere else & then apply it to the control. This includes controlling mode=two-way or one-way.

One example would be if binding results in a binding that is applied. Any good way or somehow using markup-extensiosn?

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,686 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,362 questions
XAML
XAML
A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.
769 questions
{count} vote

1 answer

Sort by: Most helpful
  1. Lars Larsson 31 Reputation points
    2023-09-28T10:10:38.24+00:00

    Guess that is the answer - no easy or native way to reuse except maybe building with attached behavior or other messy/specific fuzzy code.
    Would have been nice to use nested binding / apply a binding found using a binding.

    1 person found this answer helpful.
    0 comments No comments