Skip to content

Instantly share code, notes, and snippets.

View Char0394's full-sized avatar

Charlin Agramonte Char0394

View GitHub Profile
<CollectionView ItemsSource="{Binding Users}"
RemainingItemsThresholdReachedCommand="{Binding LoadMoreCommand}"
RemainingItemsThreshold="{Binding ItemThreshold}">
<CollectionView.Footer>
<StackLayout BindableLayout.ItemTemplate="{DynamicResource EmptyUserTemplate}"
IsVisible="{Binding IsLoadingMore}">
<BindableLayout.ItemsSource>
<x:Array Type="{x:Type x:Int32}">
<x:Int32>0</x:Int32>
</x:Array>
<StackLayout xct:StateLayout.CurrentState="{Binding CurrentState}"
xct:StateLayout.AnimateStateChanges="False">
<xct:StateLayout.StateViews>
<xct:StateView StateKey="Loading"
RepeatCount="8"
Template="{StaticResource EmptyUserTemplate}">
</xct:StateView>
</xct:StateLayout.StateViews>
</StackLayout>
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="StateLayoutSample.MainPage"
xmlns:xct="http://xamarin.com/schemas/2020/toolkit"
xmlns:controls="clr-namespace:StateLayoutSample.Controls"
Title="Users">
<ContentPage.Resources>
<ResourceDictionary>
<Style TargetType="controls:SkeletonView">
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="StateLayoutSample.MainPage"
xmlns:xct="http://xamarin.com/schemas/2020/toolkit">
<StackLayout xct:StateLayout.CurrentState="{Binding CurrentState}"
xct:StateLayout.AnimateStateChanges="False">
<CollectionView ItemsSource="{Binding Users}">
<CollectionView.ItemTemplate>
<DataTemplate>
public class SkeletonView : BoxView
{
public SkeletonView()
{
Device.StartTimer(TimeSpan.FromSeconds(1.5), () =>
{
this.FadeTo(0.5, 750, Easing.CubicInOut).ContinueWith((x) =>
{
this.FadeTo(1, 750, Easing.CubicInOut);
});
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="StateLayoutSample.MainPage"
xmlns:xct="http://xamarin.com/schemas/2020/toolkit"
xmlns:controls="clr-namespace:StateLayoutSample.Controls"
Title="Users">
<ContentPage.Resources>
<ResourceDictionary>
<Style TargetType="controls:SkeletonView">
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="StateLayoutSample.MainPage"
xmlns:xct="http://xamarin.com/schemas/2020/toolkit"
xmlns:controls="clr-namespace:StateLayoutSample.Controls"
Title="Users">
<StackLayout xct:StateLayout.CurrentState="{Binding CurrentState}"
xct:StateLayout.AnimateStateChanges="False">
<StackLayout xct:StateLayout.CurrentState="{Binding CurrentState}"
xct:StateLayout.AnimateStateChanges="False">
</StackLayout>
<ContentPage.Resources>
<xct:StateToBooleanConverter x:Key="StateToBooleanConverter" />
</ContentPage.Resources>
<ActivityIndicator IsRunning="{Binding CurrentState, Converter={StaticResource StateToBooleanConverter},
ConverterParameter={x:Static xct:LayoutState.Loading}}" />
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="StateLayoutSample.MainPage"
xmlns:xct="http://xamarin.com/schemas/2020/toolkit"
xmlns:controls="clr-namespace:StateLayoutSample.Controls">
<ContentPage.Resources>
<xct:StateToBooleanConverter x:Key="StateToBooleanConverter" />
</ContentPage.Resources>