protected override void OnAppearing()
{
base.OnAppearing();
SizeRequest customViewSize = GetCustomView().Measure(this.Width, this.Height, MeasureFlags.None);
var shimmerLayoutHeight = Math.Floor(App.ScreenHeight/ customViewSize.Request.Height);
for (int i = 0; i < shimmerLayoutHeight; i++)
{
SfShimmer shimmer = new SfShimmer() { WaveColor = Color.White };
shimmer.CustomView = GetCustomView();
shimmerLayout.Children.Add(shimmer);
}
} |
private View GetCustomView()
{
Grid grid = new Grid()
{
HeightRequest = 100,
HorizontalOptions = LayoutOptions.Start,
Margin = new Thickness(20)
};
SfBorder firstLabel = new SfBorder()
{
HeightRequest = 20,
WidthRequest = 180,
BorderWidth = 0,
BackgroundColor = Color.Gray
};
SfBorder secondLabel = new SfBorder()
{
HeightRequest = 20,
WidthRequest = 180,
BorderWidth = 0,
BackgroundColor = Color.Gray
};
StackLayout stack = new StackLayout() { Spacing = 10 };
stack.Children.Add(firstLabel);
stack.Children.Add(secondLabel);
grid.Children.Add(stack);
return grid;
}
}
|
public MonkeysPage()
{
InitializeComponent();
shimmerLayout = new StackLayout() { BackgroundColor = Color.Transparent };
shimmerLayout.SetBinding(StackLayout.IsVisibleProperty, new Binding() { Path = "IsLoaded", Converter = new BoolToInverseConverter()});
contentGrid.Children.Add(shimmerLayout, 0, 0);
}
|
Hi,
I am also looking for implementations samples of sfshimmer in sflistview, it appears my account does not have permission to download the attached zip file.