uno
uno copied to clipboard
[Desktop] FindName returns null when searching for Layout
Current behavior
FindName() fails to find ItemsRepeater
on Desktop
. It works fine on WinAppSDK
.
<Grid>
<ItemsRepeater>
<ItemsRepeater.Layout>
<StackLayout x:Name="MyLayout"/>
</ItemsRepeater.Layout>
</ItemsRepeater>
<Button
Content="Click me"
Click="Button_Click"
HorizontalAlignment="Center" />
</Grid>
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
var myElement = FindName("MyLayout");
}
}
Expected behavior
FindName() shall find ItemsRepeater on
Desktopas it does on
WinAppSDK`
How to reproduce it (as minimally and precisely as possible)
MINIMAL REPRO PROJECT: UnoFindNameApp.zip
STEPS TO REPRODUCE:
- Run the app
- place a breakpoint on
Button_Click
- click the button
- investigate
var myElement = FindName("MyLayout");
-
myElement
is null onDesktop
but contains correct value onWinAppSDK
Workaround
No response
Works on UWP/WinUI
Yes
Environment
No response
NuGet package version(s)
"Uno.Sdk": "5.4.10"
Affected platforms
Skia (WPF)
IDE
Visual Studio 2022
IDE version
No response
Relevant plugins
No response
Anything else we need to know?
No response