question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to change the color of indicators ?

See original GitHub issue

All the background images are white backgrounded. So, i need to change the color of indicators, because i need to put the indicators at the end of the image. You said: " If you want to customize indicators, you need set SelectedIndicatorStyle "

But i don´t understand the steps. Do i need to create a class to style the colors ?

My code:

<Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <cards:CarouselView Grid.Row="0" BackgroundColor="Blue" HorizontalOptions="FillAndExpand" Margin="0"
            Items="{Binding Items}" x:Name="carouselView"
            CurrentIndex="{Binding CurrentIndex}" SlideShowDuration="1500">
            <cards:CarouselView.ItemTemplate>
                <DataTemplate>
                    <ContentView>
                        <Grid Padding="0" Margin="0">
                            <ffimage:CachedImage Source="{Binding Source}" VerticalOptions="FillAndExpand"/>
                            <controls:IndicatorsControl VerticalOptions="End" HorizontalOptions="Center"/>
                        </Grid>
                    </ContentView>
                </DataTemplate>
            </cards:CarouselView.ItemTemplate>

        </cards:CarouselView>

I am lil bit newbie. Sorry if the question is stupid…

Thanks for the attention and the nugget.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
AndreiMisiukevichcommented, Jul 13, 2018

Hi @marcelinhovt no problem You did a mistake

<Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <cards:CarouselView Grid.Row="0" BackgroundColor="Blue HorizontalOptions=" FillAndExpand" Margin="0"
            Items="{Binding Items}" x:Name="carouselView"
            CurrentIndex="{Binding CurrentIndex}" SlideShowDuration="1500">
            <cards:CarouselView.ItemTemplate>
                <DataTemplate>
                    <ContentView>
                        <Grid Padding="0" Margin="0">
                            <ffimage:CachedImage Source="{Binding Source}" VerticalOptions="FillAndExpand"/>
                        </Grid>
                    </ContentView>
                </DataTemplate>
            </cards:CarouselView.ItemTemplate>

                            <controls:IndicatorsControl VerticalOptions="End" HorizontalOptions="Center"/>

        </cards:CarouselView>

Indicators control should be right INTO cardsView, So the parent of Indicators control should be CarsoueselView (Check xaml above)… Or you want to have a lot of indicators controls on each cards? =)

And yes, for customizing indicators color you will have to set styles

Declare them where you want (For example in you content page)

    <ContentPage.Resources>
        <ResourceDictionary>
            <Style x:Key="ActiveIndicator" TargetType="Frame">
                <Setter Property="BackgroundColor" Value="Red" />
            </Style>
            <Style x:Key="InactiveIndicator" TargetType="Frame">
                <Setter Property="BackgroundColor" Value="Transparent" />
                <Setter Property="OutlineColor" Value="Red" />
            </Style>
        </ResourceDictionary>
    </ContentPage.Resources>

And set them to you indicators control

        <controls:IndicatorsControl ToFadeDuration="1500"
                                    SelectedIndicatorStyle="{StaticResource ActiveIndicator}"
                                    UnselectedIndicatorStyle="{StaticResource InactiveIndicator}"/>
0reactions
AndreiMisiukevichcommented, Jan 28, 2022

@aliyailina cool!) Thanks for sharing that. Please feel free to submit PR if you think that we can enhance existing code 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do indicators actually change color
The color change of a pHindicator is caused by the dissociation of the H+ ion from the indicator itself. Recall that pH indicators...
Read more >
pH Indicators
The color change of a pH indicator is caused by the dissociation of the H + ion from the indicator itself. Recall that...
Read more >
How do acid base indicators change color?
These changes will cause the indicator to change color. Explanation: The video below shows an experiment using an indicator derived from boiling ...
Read more >
pH and Color Change - Middle School Chemistry Lesson Plans
Acids cause universal indicator solution to change from green toward red. Bases cause universal indicator to change from green toward purple. Water molecules...
Read more >
Chemical Indicators: The Science Behind Color Changes
Indicators change their colors at a certain pH range due to ionization. Unionized forms essentially have a different color than ionized forms.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found