diff --git a/src/Compatibility/ControlGallery/src/Issues.Shared/Issue11764.xaml b/src/Compatibility/ControlGallery/src/Issues.Shared/Issue11764.xaml
index 59058675411d..2d788b8f5b1f 100644
--- a/src/Compatibility/ControlGallery/src/Issues.Shared/Issue11764.xaml
+++ b/src/Compatibility/ControlGallery/src/Issues.Shared/Issue11764.xaml
@@ -5,6 +5,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://schemas.microsoft.com/dotnet/2021/maui/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:local="clr-namespace:Microsoft.Maui.Controls.ControlGallery.Issues"
mc:Ignorable="d"
x:Class="Microsoft.Maui.Controls.ControlGallery.Issues.Issue11764"
x:Name="Issue11764Page"
@@ -26,13 +27,13 @@
BackgroundColor="Red">
@@ -58,7 +59,7 @@
diff --git a/src/Compatibility/ControlGallery/src/Issues.Shared/Issue11831.xaml b/src/Compatibility/ControlGallery/src/Issues.Shared/Issue11831.xaml
index 39288ab33c28..e712236f218d 100644
--- a/src/Compatibility/ControlGallery/src/Issues.Shared/Issue11831.xaml
+++ b/src/Compatibility/ControlGallery/src/Issues.Shared/Issue11831.xaml
@@ -5,6 +5,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://schemas.microsoft.com/dotnet/2021/maui/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:local="clr-namespace:Microsoft.Maui.Controls.ControlGallery.Issues"
mc:Ignorable="d"
x:Class="Microsoft.Maui.Controls.ControlGallery.Issues.Issue11831"
x:Name="Issue11831Page"
@@ -54,7 +55,7 @@
diff --git a/src/Compatibility/ControlGallery/src/Issues.Shared/Issue9417.xaml b/src/Compatibility/ControlGallery/src/Issues.Shared/Issue9417.xaml
index fada54683d2d..956596d43bb5 100644
--- a/src/Compatibility/ControlGallery/src/Issues.Shared/Issue9417.xaml
+++ b/src/Compatibility/ControlGallery/src/Issues.Shared/Issue9417.xaml
@@ -40,7 +40,7 @@
ProvideValue(VariableDefinitionReference
context.LoggingHelper.LogWarningOrError(BuildExceptionCode.UnattributedMarkupType, context.XamlFilePath, node.LineNumber, node.LinePosition, 0, 0, vardefref.VariableDefinition.VariableType);
if (vardefref.VariableDefinition.VariableType.FullName == "Microsoft.Maui.Controls.Xaml.BindingExtension"
- && (node.Properties == null || !node.Properties.ContainsKey(new XmlName("", "Source"))) //do not compile bindings if Source is set
&& bpRef != null //do not compile bindings if we're not gonna SetBinding
)
foreach (var instruction in CompileBindingPath(node, context, vardefref.VariableDefinition))
diff --git a/src/Controls/tests/Xaml.UnitTests/BindingsCompiler.xaml b/src/Controls/tests/Xaml.UnitTests/BindingsCompiler.xaml
index a12f94e7b5b1..6e3adfbbe001 100644
--- a/src/Controls/tests/Xaml.UnitTests/BindingsCompiler.xaml
+++ b/src/Controls/tests/Xaml.UnitTests/BindingsCompiler.xaml
@@ -21,6 +21,8 @@
+
+
diff --git a/src/Controls/tests/Xaml.UnitTests/BindingsCompiler.xaml.cs b/src/Controls/tests/Xaml.UnitTests/BindingsCompiler.xaml.cs
index ca3235128db9..fa70f4406c28 100644
--- a/src/Controls/tests/Xaml.UnitTests/BindingsCompiler.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/BindingsCompiler.xaml.cs
@@ -105,6 +105,9 @@ public void Test(bool useCompiledXaml)
//testing invalid bindingcontext type
layout.BindingContext = new object();
Assert.AreEqual(null, layout.label0.Text);
+
+ //testing source
+ Assert.That(layout.label12.Text, Is.EqualTo("Text for label12"));
}
}
}
diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Gh3606.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Gh3606.xaml.cs
index bea170695bdb..d75aa2e0a794 100644
--- a/src/Controls/tests/Xaml.UnitTests/Issues/Gh3606.xaml.cs
+++ b/src/Controls/tests/Xaml.UnitTests/Issues/Gh3606.xaml.cs
@@ -8,6 +8,7 @@
namespace Microsoft.Maui.Controls.Xaml.UnitTests
{
+ [XamlCompilation(XamlCompilationOptions.Skip)]
public partial class Gh3606 : ContentPage
{
public Gh3606()
@@ -28,9 +29,18 @@ class Tests
[TearDown] public void TearDown() => DispatcherProvider.SetCurrent(null);
[TestCase(true)]
- public void BindingsWithSourceArentCompiled(bool useCompiledXaml)
+ [TestCase(false)]
+ public void BindingsWithSourceAreCompiled(bool useCompiledXaml)
{
- new Gh3606(useCompiledXaml);
+ if (useCompiledXaml)
+ {
+ // The XAML file contains a mismatch between the source the x:DataType attribute so the compilation of the binding will fail
+ Assert.Throws(new BuildExceptionConstraint(4, 16), () => MockCompiler.Compile(typeof(Gh3606)));
+ }
+ else
+ {
+ Assert.DoesNotThrow(() => new Gh3606(useCompiledXaml: false));
+ }
}
}
}