Xamarin.Tips – Xamarin.Forms iOS ListView Refresh Spinner Color

Here’s a quick freebie. If you want to change the color of your ListView Refreshing spinner, we can do that with a quick custom renderer!

Here it is as a renderer:

ColoredRefreshListViewRenderer.cs

    ///<summary>
    /// Custom renderer for all list views to use the custom loader color
    /// </summary>

    public class ColoredRefreshListViewRenderer : ListViewRenderer
    {
        ///<summary>
        /// Set the loader color to your custom color
        /// </summary>
        protected override void OnElementChanged(ElementChangedEventArgs<ListView> e)
        {
            base.OnElementChanged(e);
            var vc = ((UITableViewController)ViewController);

            // Set the color!
            if (vc?.RefreshControl != null)
                vc.RefreshControl.TintColor = UIColor.FromRGB(135, 200, 21);
        }
    }

Now we get something looking awesome like this:
 

loading_apple_green

If you like what you see, don’t forget to follow me on twitter @Suave_Pirate, check out my GitHub, and subscribe to my blog to learn more mobile developer tips and tricks!

3 thoughts on “Xamarin.Tips – Xamarin.Forms iOS ListView Refresh Spinner Color”

  1. Thanks so much for this great post! One thing I notice when trying to implement it is that it does not work during the initial load of the list view… The spinner is still a dark color, no matter what I specify as the color it should be. On subsequent pull-to-refresh actions, the spinner is the correct color. Do you have any idea why this might be, and how to fix it so it’s the correct color even on initial load?

    Like

  2. Thanks so much for this great post! One thing I notice when trying to implement it is that it does not work during the initial load of the list view… The spinner is still a dark color, no matter what I specify as the color it should be. On subsequent pull-to-refresh actions, the spinner is the correct color. Do you have any idea why this might be, and how to fix it so it’s the correct color even on initial load?

    Like

    1. Good call out. I guess I never noticed this because I tend to use a separate loader for initial load. Have you tried moving the renderer logic to a different lifecycle method in the control? Only thing I can think of right away.

      Like

Leave a comment