Repository navigation
Description
Current behavior 🐛
FrameworkElement.GetBindingExpression(DependencyProperty) is not available in Uno Platform 7.0.
Until 7.0, Uno exposed a public DependencyObject.GetBindingExpression(DependencyProperty). That member was Uno-only (WinUI declares GetBindingExpression on FrameworkElement, not on DependencyObject), and 1237cecff83 correctly demoted it to internal as part of narrowing the public surface for BC26.
However, Uno never implemented the WinUI-parity member either — src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Xaml/FrameworkElement.cs:144 records it as:
// Forced skipping of method Microsoft.UI.Xaml.FrameworkElement.GetBindingExpression(Microsoft.UI.Xaml.DependencyProperty)
Net effect: 7.0 removed the Uno-only API without a parity replacement existing, so there is now no supported way for a library to read the BindingExpression of a bound property. This breaks shipped call sites in first-party libraries (Uno.Toolkit.UI, Uno.Extensions) with CS1061.
Expected behavior 🎯
FrameworkElement.GetBindingExpression(DependencyProperty) should exist and be public, matching WinUI.
WinUI declares it in the public IDL on FrameworkElement, right next to SetBinding:
// dxaml/xcp/dxaml/idl/winrt/core/microsoft.ui.xaml.coretypes.idl:2520
unsealed runtimeclass FrameworkElement
...
void SetBinding(Microsoft.UI.Xaml.DependencyProperty dp, Microsoft.UI.Xaml.Data.BindingBase binding);
Microsoft.UI.Xaml.Data.BindingExpression GetBindingExpression(Microsoft.UI.Xaml.DependencyProperty dp);Implementation: dxaml/xcp/dxaml/lib/FrameworkElement_Partial.cpp:89,118. It reads the unevaluated local value and queries it for IBindingExpression, returning null rather than throwing when the property is not bound.
How to reproduce it (as minimally and precisely as possible) 🔬
FrameworkElement sut = new ContentControl { Tag = 42d };
sut.SetBinding(FrameworkElement.WidthProperty, new Binding { Source = sut, Path = new PropertyPath("Tag") });
// Uno 7.0: CS1061 - 'FrameworkElement' does not contain a definition for 'GetBindingExpression'
// WinUI / Uno 6.x: returns the BindingExpression
var expression = sut.GetBindingExpression(FrameworkElement.WidthProperty);Workaround 🛠️
None for external consumers. In-repo code and InternalsVisibleTo assemblies can still reach the internal DependencyObject.GetBindingExpression.
Affected platforms
All — this is a public API surface gap, not a renderer-specific issue.
Uno.UI version
7.0.0-dev.645
Activity
feat: Add FrameworkElement.GetBindingExpression