Xamarin.Forms.PancakeView icon indicating copy to clipboard operation
Xamarin.Forms.PancakeView copied to clipboard

DynamicResource color not working on Border

Open AnthonyNjuguna opened this issue 4 years ago • 12 comments

This doesn't work

<yummy:PancakeView.Border>
   <yummy:Border  Thickness="3" Color="{DynamicResource AccentColour}" />
</yummy:PancakeView.Border>

but this does

<yummy:PancakeView.Border>
     <yummy:Border Thickness="3" Color="{StaticResource AccentColour}" />
</yummy:PancakeView.Border>

AnthonyNjuguna avatar Aug 06 '20 16:08 AnthonyNjuguna

That sounds odd. Not quite sure what could be causing that to be honest. Would have to dig deeper.

Not quite sure when I'd get around to that though.

sthewissen avatar Aug 06 '20 16:08 sthewissen

It looks like this problem starts after upgrading 1.4.2 to 2.0.0.691+. Downgrading to 1.4.2 solves the problem for us.

netdevle avatar Aug 07 '20 15:08 netdevle

Yes, seeing this today with my app as well :(

jamesmontemagno avatar Aug 07 '20 22:08 jamesmontemagno

This is most likely due to the object that this border is created by doesn't get notified appropriately by the changing runtime resource and hence doesn't cause a redraw. However, the bindable property itself has not been changed, just moved elsewhere, so I would kind of expect the same behavior. So far I don't have a fix.

sthewissen avatar Aug 10 '20 17:08 sthewissen

This problem is also happening with the GradientStop colors in the BackgroundGradientStops collection.

       <custom:PancakeView
        BackgroundGradientStartPoint="0,0"
        BackgroundGradientEndPoint="0,1"
        HasShadow="False"
        CornerRadius="0">

        <custom:PancakeView.BackgroundGradientStops>
            <custom:GradientStopCollection>
                <custom:GradientStop
                    Color="{DynamicResource GradiantBlueToOrange_End}"
                    Offset="0" />
                <custom:GradientStop
                    Color="{DynamicResource GradiantBlueToOrange_Start}"
                    Offset="1" />

            </custom:GradientStopCollection>
        </custom:PancakeView.BackgroundGradientStops>

Nerves82 avatar Aug 18 '20 15:08 Nerves82

Got the same problem with BackgroundGradientStops =/

Flying--Dutchman avatar Aug 27 '20 16:08 Flying--Dutchman

Hi @sthewissen , same here - Border color set by DynamicResource is not working commented xaml was for previous versions of PancakeView.

Also, the changes made in this XAML doesn't reflect when using Xamarin HotReload. Any clue on that also ?

                              <yummy:PancakeView
                                    x:Name="SDPancakeView"
                                    Margin="5"
                                    BackgroundColor="{DynamicResource MainMenuItemsBackgroundColor}"
                                    BackgroundGradientEndPoint="1,0"
                                    BackgroundGradientStartPoint="0,0"
                                    CornerRadius="{DynamicResource SDPancakeViewCR}"
                                    HeightRequest="50"
                                    HorizontalOptions="FillAndExpand"
                                    IsClippedToBounds="True">

                                    <!--
                                        BorderGradientAngle="50"
                                        DashPattern="None"
                                        
                                        GradientEndPoint="1,0"
                                        GradientStartPoint="0,0"
                                    -->
                                    <yummy:PancakeView.Border>
                                        <yummy:Border
                                            DashPattern="10,0"
                                            DrawingStyle="Inside"
                                            Thickness="16"
                                            Color="{DynamicResource MainMenuItemsBackgroundColor}" />
                                    </yummy:PancakeView.Border>

                                    <yummy:PancakeView.BackgroundGradientStops>
                                        <yummy:GradientStopCollection>
                                            <yummy:GradientStop Offset="0" Color="{DynamicResource SDPankcackeViewBGStartColor}" />
                                            <yummy:GradientStop Offset="0.5" Color="{DynamicResource MainMenuItemsBackgroundColor}" />
                                            <yummy:GradientStop Offset="1" Color="{DynamicResource SDPankcackeViewBGEndColor}" />
                                        </yummy:GradientStopCollection>
                                    </yummy:PancakeView.BackgroundGradientStops>


                                    <!--<yummy:PancakeView x:Name="SDPancakeView"
                                                   Margin="5"
                                                   BackgroundColor="{DynamicResource MainMenuItemsBackgroundColor}"
                                                   BackgroundGradientEndColor="{DynamicResource SDPankcackeViewBGEndColor}"
                                                   BackgroundGradientStartColor="{DynamicResource SDPankcackeViewBGStartColor}"
                                                   BorderDrawingStyle="Inside"
                                                   BackgroundGradientStartPoint="0,0"
                                                   CornerRadius="{DynamicResource SDPancakeViewCR}"
                                                   HeightRequest="50"
                                                   HorizontalOptions="FillAndExpand"
                                                   IsClippedToBounds="True">-->

                                    <!--<yummy:PancakeView Margin="5"
                                                   BackgroundColor="{DynamicResource MainMenuItemsBackgroundColor}"
                                                   BackgroundGradientAngle="110"
                                                   BackgroundGradientEndColor="{DynamicResource MainMenuFooterBackgroundColor}"
                                                   BackgroundGradientStartColor="{DynamicResource MainMenuItemsBackgroundColor}"
                                                   BorderDrawingStyle="Inside"
                                                   CornerRadius="15,0,0,15"
                                                   FlowDirection="LeftToRight"
                                                   HeightRequest="50"
                                                   HorizontalOptions="FillAndExpand"
                                                   IsClippedToBounds="True">-->

                               </yummy:PancakeView>

npagare avatar Sep 06 '20 21:09 npagare

Hey @sthewissen , have you got the fix yet? The issue still appears.

w0desym avatar Dec 10 '20 19:12 w0desym

Ye same issue here when setting the Border and BackgroundGradientStops

IeuanWalker avatar Jun 28 '21 15:06 IeuanWalker

it's a pity that is not supported as it's a wonderful control, we removed pancakeView from all our projects as we could not make it work with dynamicResource and it was essential as we had to support darkmode.

developer9969 avatar Jun 28 '21 16:06 developer9969

it's a pity that is not supported as it's a wonderful control, we removed pancakeView from all our projects as we could not make it work with dynamicResource and it was essential as we had to support darkmode.

might need to do the same tbh

IeuanWalker avatar Jun 28 '21 16:06 IeuanWalker

Sorry to hear it. I simply don't have the time to investigate/implement this right now. I wish it were different, but the repo is open to PRs if it's a must-have for you.

sthewissen avatar Jun 28 '21 18:06 sthewissen