Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Added CornerRadius bindable property #1732

Merged
merged 7 commits into from
Jan 19, 2022
Merged

Added CornerRadius bindable property #1732

merged 7 commits into from
Jan 19, 2022

Conversation

espritm
Copy link
Contributor

@espritm espritm commented Nov 25, 2021

Description of Bug

Adding BadgeView.CornerRadius property

Issues Fixed

Behavioral Changes

PR Checklist

  • Has a linked Issue, and the Issue has been approved
  • Rebased on top of main at time of PR
  • Changes adhere to coding standard

@net-foundation-cla
Copy link

net-foundation-cla bot commented Nov 25, 2021

CLA assistant check
All CLA requirements met.

@ghost

This comment has been minimized.

Copy link
Collaborator

@jsuarezruiz jsuarezruiz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you include a sample (for example a Slider to change the CornerRadius) here https://github.com/xamarin/XamarinCommunityToolkit/blob/main/samples/XCT.Sample/Pages/Views/BadgeViewPage.xaml?

/// <summary>
/// Backing BindableProperty for the <see cref="CornerRadius"/> property.
/// </summary>
public static readonly BindableProperty CornerRadiusProperty =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was initialized like this before my change.

https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Views/BadgeView/BadgeView.shared.cs#L277

Setting those default values will prevent to modify the badgeview appearance when people will update the nuget package.

I will add a sample OK, thanks for your feedback

@TheCodeTraveler TheCodeTraveler added this to the 2.0.0 milestone Dec 2, 2021
@jfversluis
Copy link
Member

Added a sample

image

And fixed a bug with the default value being an int and not a float.

@jfversluis
Copy link
Member

Thanks for your very first contribution to GitHub @espritm ! We're honored that you chose the Toolkit to be the project to contribute to!

@VladislavAntonyuk VladislavAntonyuk enabled auto-merge (squash) January 19, 2022 17:06
@@ -6,6 +6,7 @@ namespace Xamarin.CommunityToolkit.Sample.ViewModels.Views
public class BadgeViewViewModel : BaseViewModel
{
int counter;
float cornerRadius;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest using double since it's the type used by Xamarin.Forms as you can see here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
Frame Corner radius is float

Copy link
Contributor

@pictos pictos Jan 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm... We missed that on the first Code Review, we can change it on the Badge control and release this one on v2.0 as a breaking change... Or we can leave at it's and change it on MCT. Both work for me, what do you think?

Never mind I saw that Frame.CornerRadius is float, so XF also didn't care about it.

@AlleSchonWeg
Copy link

Hi,
is #692 realy fixed?
If Badge.Text="1" for example the badge is still oval.

@bijington
Copy link
Contributor

@AlleSchonWeg what version of the toolkit are you using? If you believe there is an issue can you open a bug report using the template please?

@AlleSchonWeg
Copy link

AlleSchonWeg commented Mar 19, 2022

@bijington,
Not sure if this is a bug. I'm using version 2.0.0

@pictos
Copy link
Contributor

pictos commented Mar 19, 2022

@AlleSchonWeg please open a bug, following the template, with a small sample project that reproduce your issue

@espritm espritm deleted the badgeview-cornerradius branch June 24, 2022 15:12
@LeoJHarris
Copy link
Contributor

LeoJHarris commented Sep 7, 2022

I don't see this fixed either. Still displaying as oval using v2.0.4. I cant make the badge view round but would love to know how.

image

using this XAML:

<Grid RowDefinitions="auto,auto">
                                        <xct:BadgeView
                                            Grid.Row="0"
                                            BackgroundColor="Red"
                                            FontAttributes="Bold"
                                            FontSize="Small"
                                            Text="1"
                                            TextColor="White">
                                            <Image>
                                                <Image.Source>
                                                    <FontImageSource
                                                        FontFamily="MaterialDesignIcons"
                                                        Glyph="{x:Static fonts:MaterialDesignIcons.TextBoxMultiple}"
                                                        Size="{StaticResource SmallFontImageSize}"
                                                        Color="{AppThemeBinding Light={StaticResource LightTextColor},
                                                                                Dark={StaticResource DarkTextColor}}" />
                                                </Image.Source>
                                            </Image>
                                        </xct:BadgeView>
                                        <Label
                                            Grid.Row="1"
                                            HorizontalOptions="Center"
                                            HorizontalTextAlignment="Center"
                                            Style="{StaticResource LabelSmallHeaderStyle}"
                                            Text="Surveys"
                                            TextColor="{AppThemeBinding Light={StaticResource LightTextColor},
                                                                        Dark={StaticResource DarkTextColor}}" />
                                    </Grid>

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] BadgeView should be round
9 participants