WinUI3 issues with Frame loading and returning
春辉 马
0
Reputation points
I'm having a magical issue with Frame, it's random. My basic code is as follows
But when I load, 99% of the time it loads successfully, and when I return, there is a high probability that there will be no content
First use ItemsRepeater to load the list, its ItemTemplate inside a custom control, and the custom control contains a Frame
<ItemsRepeaterScrollHost HorizontalAlignment="Center">
<ScrollViewer IsVerticalScrollChainingEnabled="False">
<ItemsRepeater
x:Name="StaggeredRepeater"
ItemTemplate="{StaticResource StaggeredTemplate}"
ItemsSource="{Binding Widgets}">
<ItemsRepeater.Layout>
<common:StaggeredLayout
Padding="0,8,0,0"
HorizontalAlignment="Center"
ColumnSpacing="8"
DesiredColumnWidth="300"
RowSpacing="8" />
</ItemsRepeater.Layout>
</ItemsRepeater>
</ScrollViewer>
</ItemsRepeaterScrollHost>
Below are the loading Page code
private void ContentFrame_Loading(FrameworkElement sender, object args)
{
NavigateHelper.AddFrame(Id, this.ContentFrame,AddFrameType.Replace);
ContentFrame.Navigate(this.WidgetContent, WidgetSize, new DrillInNavigationTransitionInfo());
}
Below are the codes that return Page
var frame = NavigateHelper.GetFrame(WidgetId);
if (frame!=null&&frame.CanGoBack)
{
frame.GoBack();
}
Sign in to answer