Sharpnado.TaskLoaderView
Sharpnado.TaskLoaderView copied to clipboard
The result/error template is not displayed when first loaded in MAUI-7.0
Platform (please complete the following information):
- OS: [Android]
- Device: [AndroidEmulator/ Android Phone]
- SDK version: [Android SDK 30]
- MAUI-7.0
Describe the bug The result/error template is not displayed when loaded first, but it's ok in the next refreshing, and it's ok when the view is tapped.
I remove the ScrollView surrounding the tlv:TemplatedTaskLoader</tlv:TemplatedTaskLoader>, it's ok. I doubt there is a lack of focus behavior in the ScrollView.
To Reproduce Cover the default demo with CommandsPage in the Retronado.Maui project.
The issue XAML
<RefreshView IsRefreshing="{Binding Loader.ShowRefresher}"
RefreshColor="{StaticResource Primary}"
Command="{Binding Loader.RefreshCommand}">
<ScrollView>
<tlv:TemplatedTaskLoader TaskLoaderNotifier="{Binding Loader}">
<tlv:TemplatedTaskLoader.ResultControlTemplate>
<ControlTemplate>
<VerticalStackLayout
x:DataType="local:MainPageViewModel"
BindingContext="{Binding Source={RelativeSource
AncestorType={x:Type local:MainPageViewModel}}}">
<Label Text="hello world"></Label>
<Label Text="{Binding Loader.Result}"></Label>
</VerticalStackLayout>
</ControlTemplate>
</tlv:TemplatedTaskLoader.ResultControlTemplate>
<tlv:TemplatedTaskLoader.LoadingControlTemplate>
<ControlTemplate>
<ActivityIndicator Color="{StaticResource Primary}"
IsRunning="True"
HorizontalOptions="Center"
VerticalOptions="Center" />
</ControlTemplate>
</tlv:TemplatedTaskLoader.LoadingControlTemplate>
<tlv:TemplatedTaskLoader.ErrorControlTemplate>
<ControlTemplate>
<VerticalStackLayout BindingContext="{Binding Source={RelativeSource AncestorType={x:Type tlv:TemplatedTaskLoader}},
Path=TaskLoaderNotifier}"
x:DataType="tlv:ITaskLoaderNotifier">
<Label Text="{Binding Error}"></Label>
</VerticalStackLayout>
</ControlTemplate>
</tlv:TemplatedTaskLoader.ErrorControlTemplate>
</tlv:TemplatedTaskLoader>
</ScrollView>
</RefreshView>
The workaround XAML
<RefreshView IsRefreshing="{Binding Loader.ShowRefresher}"
RefreshColor="{StaticResource Primary}"
Command="{Binding Loader.RefreshCommand}">
<tlv:TemplatedTaskLoader TaskLoaderNotifier="{Binding Loader}">
<tlv:TemplatedTaskLoader.ResultControlTemplate>
<ControlTemplate>
<ScrollView>
<VerticalStackLayout
x:DataType="local:MainPageViewModel"
BindingContext="{Binding Source={RelativeSource
AncestorType={x:Type local:MainPageViewModel}}}">
<Label Text="hello world"></Label>
<Label Text="{Binding Loader.Result}"></Label>
</VerticalStackLayout>
</ScrollView>
</ControlTemplate>
</tlv:TemplatedTaskLoader.ResultControlTemplate>
<tlv:TemplatedTaskLoader.LoadingControlTemplate>
<ControlTemplate>
<ActivityIndicator Color="{StaticResource Primary}"
IsRunning="True"
HorizontalOptions="Center"
VerticalOptions="Center" />
</ControlTemplate>
</tlv:TemplatedTaskLoader.LoadingControlTemplate>
<tlv:TemplatedTaskLoader.ErrorControlTemplate>
<ControlTemplate>
<ScrollView>
<VerticalStackLayout BindingContext="{Binding Source={RelativeSource AncestorType={x:Type tlv:TemplatedTaskLoader}},
Path=TaskLoaderNotifier}"
x:DataType="tlv:ITaskLoaderNotifier">
<Label Text="{Binding Error}"></Label>
</VerticalStackLayout>
</ScrollView>
</ControlTemplate>
</tlv:TemplatedTaskLoader.ErrorControlTemplate>
</tlv:TemplatedTaskLoader>
</RefreshView>
There is no issue with the Windows platform. I just test on Android and Windows.
was it working in .net6 ?
@roubachof The same issue with .net6.
For me, the issue is still present in MAUI 8.0.20 and I find that the data appears if the size of the control is changed. EG: Setting a MinHeight in the Xaml whilst the debugger is attached. I don't want a scroll control as the control I am presenting already handles the scroll. Not sure if this is related to a MAUI bug or a bug here. Only tested with Android.
@rwecho @m1dst pls attach a repro link or zip so I can go to the bottom of this :)