Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/Controls/src/SourceGen/KnownMarkups.cs
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,10 @@ internal static bool ProvideValueForReferenceExtension(ElementNode markupNode, S
value = $"{namescope.namesInScope[name!].Name}";
return true;
}
node = node.Parent as ElementNode;
INode n = node;
while (n.Parent is ListNode ln)
n = ln.Parent;
node = n.Parent as ElementNode;
}

//TODO report diagnostic
Expand Down
50 changes: 50 additions & 0 deletions src/Controls/tests/Xaml.UnitTests/Issues/Maui31995.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Microsoft.Maui.Controls.Xaml.UnitTests.Issues.Maui31995"
Title="Maui31995"
x:Name="thisControl24">
<VerticalStackLayout BindableLayout.ItemsSource="{Binding ItemsSource, Source={x:Reference thisControl24}}">
<BindableLayout.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.Triggers>
<DataTrigger TargetType="Grid" Binding="{Binding Selected}" Value="False">
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup Name="CommonStates">
<VisualState Name="Normal">
<VisualState.Setters>
<Setter Property="BackgroundColor" Value="{Binding BackgroundColor, Source={x:Reference thisControl24}}"/>
</VisualState.Setters>
</VisualState>
<VisualState Name="PointerOver">
<VisualState.Setters>
<Setter Property="BackgroundColor" Value="{Binding BackgroundColor, Source={x:Reference thisControl24}}"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</DataTrigger>
<DataTrigger TargetType="Grid" Binding="{Binding Selected}" Value="True">
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup Name="CommonStates">
<VisualState Name="Normal">
<VisualState.Setters>
<Setter Property="BackgroundColor" Value="{Binding BackgroundColor, Source={x:Reference thisControl24}}"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</DataTrigger>
</Grid.Triggers>
<Label Text="{Binding .}" />

</Grid>
</DataTemplate>
</BindableLayout.ItemTemplate>
</VerticalStackLayout>
</ContentPage>
19 changes: 19 additions & 0 deletions src/Controls/tests/Xaml.UnitTests/Issues/Maui31995.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
namespace Microsoft.Maui.Controls.Xaml.UnitTests.Issues;
#nullable enable

public partial class Maui31995 : ContentPage
{
public Maui31995() => InitializeComponent();

int count = 0;
public List<object> ItemsSource = new(); // Added.



private void OnCounterClicked(object? sender, EventArgs e)
{
count++;
}
}