ControlTemplate not propagating the BindingContext correctly #12470
Labels
area-xaml
XAML, CSS, Triggers, Behaviors
fixed-in-8.0.0-preview.1.7762
Look for this fix in 8.0.0-preview.1.7762!
p/1
Work that is important, and has been scheduled for release in this or an upcoming sprint
partner/cat 😻
this is an issue that impacts one of our partners or a customer our advisory team is engaged with
partner
Issue or Request from a partner team
platform/android 🤖
platform/iOS 🍎
platform/macOS 🍏
macOS / Mac Catalyst
platform/windows 🪟
t/bug
Something isn't working
Milestone
Description
The bug manifests itself when using a
ContentView
with a customControlTemplate
. For some reason, theBindingContext
is not propagated to the children created with theControlTemplate
. This makes it impossible to use regular data binding in theControlTemplate
. For example, let's consider the following trivial scenario:The first
Label
that is placed directly in theVerticalStackLayout
displays theText
property form theBindingContext
correctly. The secondLabel
that is created from theControlTemplate
does not display anything at all.Steps to Reproduce
Label
sLabel
displays the text correctlyLabel
from theControlTemplate
is emptyLink to public reproduction project repository
https://github.com/ivan-todorov-progress/maui-control-template-binding-context-bug
Version with bug
7.0 (current)
Last version that worked well
Unknown/Other
Affected platforms
iOS, Android, Windows, macOS
Affected platform versions
N/A
Did you find any workaround?
The workaround is to propagate the
BindingContext
manually, e.g.:Relevant log output
No response
The text was updated successfully, but these errors were encountered: