This is a migrated thread and some comments may be shown as answers.

How to change RadListView PullToRefresh Activity Indicator cell background color?

7 Answers 210 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Alius
Top achievements
Rank 1
Alius asked on 11 Jul 2016, 08:49 PM

Maybe someone already faced this issue: My app background is white, RadListView Item Background is also White, but when I'm trying to do PullToRefresh black cell pops out with white Activity Indicator inside. Preview here: http://tinypic.com/r/5pkcgw/9

Any hint how to make it White instead of Black?

<telerik:RadListView x:Name="SocialFeed" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"
        SelectionMode="Single" IsPullToRefreshEnabled="True" BackgroundColor="Red">
    <telerik:RadListView.LayoutDefinition>
        <listView:ListViewLinearLayout Orientation="Vertical" VerticalItemSpacing="0" />
    </telerik:RadListView.LayoutDefinition>
    <telerik:RadListView.ItemStyle>
        <listView:ListViewItemStyle BackgroundColor="White" BorderWidth="1" BorderColor="#C8C7CC" BorderLocation="Bottom" />
    </telerik:RadListView.ItemStyle>   
    <telerik:RadListView.PressedItemStyle>
            <listView:ListViewItemStyle BackgroundColor="White" BorderWidth="1" BorderColor="#C8C7CC" BorderLocation="Bottom" />
    </telerik:RadListView.PressedItemStyle>
    <telerik:RadListView.SelectedItemStyle>
            <listView:ListViewItemStyle BackgroundColor="White" BorderWidth="1" BorderColor="#C8C7CC" BorderLocation="Bottom" />
    </telerik:RadListView.SelectedItemStyle>
    <telerik:RadListView.ItemTemplate>
        <DataTemplate>
        ...
        </DataTemplate>
    </telerik:RadListView.ItemTemplate>                                
</telerik:RadListView>

7 Answers, 1 is accepted

Sort by
0
Rosy Topchiyska
Telerik team
answered on 15 Jul 2016, 08:32 AM
Hello Alius,

Thank you for contacting us.

The list view does not expose API to change the background if the refresh indicator, but you can easily change it with a custom list view renderer. I have attached a sample that demonstrates this. Please, take a look at the CustomListViewRenderer class in the AppDelegate.cs file in the iOS project.

I hope this helps.

Regards,
Rosy Topchiyska
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Remi
Top achievements
Rank 1
answered on 08 Dec 2017, 02:50 PM

Hello,

Another possibility could be to use the UIAppearance, eliminating the need of a custom renderer.

var colorAccent = ((Color)Xamarin.Forms.Application.Current.Resources["ColorAccent"]).ToUIColor();
 
// RadListView PullToRefresh controls
TKListViewPullToRefreshView.Appearance.TintColor = colorAccent;
TKListViewPullToRefreshView.Appearance.BackgroundColor = UIColor.White;

One question though, whereas BackgroundColor is effectively taken into account, the usual TintColor does not change the loading indicator color. Is there any way to change it in a RadListView?

0
Stefan Nenchev
Telerik team
answered on 13 Dec 2017, 11:38 AM
Hello, Remi,

As far as I understand your requirement, you would like to change the color of the indicator view. if this is the case, you can access the Indicator View through the ActivityIndicator property of the PullToRefreshView:

protected override void OnElementChanged(ElementChangedEventArgs<RadListView> e)
        {
            base.OnElementChanged(e);
 
            this.Control.PullToRefreshView.BackgroundColor = UIColor.White;
            this.Control.PullToRefreshView.ActivityIndicator.Color = UIColor.Red;
        }

I hope this helps.

Regards,
Stefan Nenchev
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Remi
Top achievements
Rank 1
answered on 18 Dec 2017, 01:26 PM

Hello Stefan,

I confirm that using the custom renderer h     

0
Remi
Top achievements
Rank 1
answered on 18 Dec 2017, 01:29 PM

Hello Stefan,

I confirm that by using a custom renderer, I can achieve the desired behavior, many thanks to you.

What I don't understand just yet is why Appearance is working for PullToRefreshView background color, but not for UIActivityIndicator color. I can live with that though, and i'll do the same in an Android renderer for ActivityIndicator color as well.

0
Remi
Top achievements
Rank 1
answered on 18 Dec 2017, 01:32 PM

Hello Stefan,

I confirm that using by a custom renderer, I can achieve the desired behavior, many thanks to you.

What I don't perfectly understand just yet is why setting the Appearance is working for PullToRefreshView background color, but doesn't for UIActivityIndicator color, but I can live with that.

I'll just apply the same principles for Android ActivityIndicator color, creating a specific renderer.

0
Stefan Nenchev
Telerik team
answered on 19 Dec 2017, 01:29 PM
Hello, Remi,

I am not sure about that, it seems like platform specific implementation. Anyway, using the custom renderers should do so you can stick to that approach.

Have a great rest of the week.

Regards,
Stefan Nenchev
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
ListView
Asked by
Alius
Top achievements
Rank 1
Answers by
Rosy Topchiyska
Telerik team
Remi
Top achievements
Rank 1
Stefan Nenchev
Telerik team
Share this question
or