Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Proposal] BadgeView #105

Closed
2 of 10 tasks
TheCodeTraveler opened this issue Sep 28, 2021 · 3 comments
Closed
2 of 10 tasks

[Proposal] BadgeView #105

TheCodeTraveler opened this issue Sep 28, 2021 · 3 comments
Assignees
Labels
approved This Proposal has been approved and is ready to be added to the Toolkit champion A member of the .NET MAUI Toolkit core team has chosen to champion this feature pending documentation This feature requires documentation proposal A fully fleshed out proposal describing a new feature in syntactic and semantic detail

Comments

@TheCodeTraveler
Copy link
Collaborator

TheCodeTraveler commented Sep 28, 2021

BadgeView

  • Proposed
  • Prototype
  • Implementation
    • iOS Support
    • Android Support
    • macOS Support
    • Windows Support
  • Unit Tests: Not Started
  • Sample
  • Documentation: Not Started

Summary

The BadgeView allows the user to show a badge with a string value on top of any control. By wrapping a control in a BadgeView control, you can show a badge value on top of it. This is very much like the badges you see on the app icons on iOS and Android.

Motivation

Detailed Design

BadgeView.shared.cs

[ContentProperty(nameof(Content))]
public class BadgeView : BaseTemplatedView<Grid>
{
  public static readonly BindableProperty ContentProperty;
  public static readonly BindableProperty BadgePositionProperty;
  public static BindableProperty AutoHideProperty;
  public static BindableProperty IsAnimatedProperty;
  public static BindableProperty BadgeAnimationProperty;
  public static new BindableProperty BackgroundColorProperty;
  public static readonly BindableProperty BorderColorProperty;
  public static readonly BindableProperty HasShadowProperty;
  public static BindableProperty TextColorProperty;
  public static BindableProperty TextProperty;
  public static BindableProperty FontSizeProperty;
  public static BindableProperty FontFamilyProperty;
  public static BindableProperty FontAttributesProperty;
  
  public View? Content { get; set; }
  public BadgePosition BadgePosition { get; set; }
  public bool AutoHide { get; set; }
  public bool IsAnimated { get; set; }
  public IBadgeAnimation? BadgeAnimation { get; set; }
  public new Color BackgroundColor { get; set; }
  public Color BorderColor { get; set; }
  public bool HasShadow { get; set; }
  public Color TextColor { get; set; }
  public string Text { get; set; }
  [TypeConverter(typeof(FontSizeConverter))]
  public double FontSize { get; set; }
  public string FontFamily { get; set; }
  public FontAttributes FontAttributes { get; set; }
}

Usage Syntax

XAML Usage

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:xct="http://xamarin.com/schemas/2020/toolkit"
             x:Class="MyLittleApp.MainPage">

     <StackLayout>

        <xct:BadgeView
            BackgroundColor="Red"
            FontAttributes="Bold"
            FontSize="Medium"
            TextColor="White"
            Text="1">
            <Label
                Text="This label has a badge in the top-right"/>
        </xct:BadgeView>

    </StackLayout>

</ContentPage>

C# Usage

class MyPage : ContentPage
{
  public MyPage()
  {
    Content = new BadgeView
    {
      BackgroundColor = Colors.Red,
      FontAttributes = FontAttributes.Bold,
      TextColor = Colors.White,
      Text = "1",
      Cotent = new Label { Text = "This label has a badge in the top-right" }
    };
  }
}
@TheCodeTraveler TheCodeTraveler added new proposal A fully fleshed out proposal describing a new feature in syntactic and semantic detail labels Sep 28, 2021
@TheCodeTraveler TheCodeTraveler added this to the v1.0.0 milestone Sep 28, 2021
@pictos pictos self-assigned this Oct 4, 2021
@pictos pictos added the help wanted This proposal has been approved and is ready to be implemented label Oct 5, 2021
@TheCodeTraveler TheCodeTraveler added approved This Proposal has been approved and is ready to be added to the Toolkit champion A member of the .NET MAUI Toolkit core team has chosen to champion this feature pending documentation This feature requires documentation and removed new labels Oct 5, 2021
@TheCodeTraveler TheCodeTraveler linked a pull request Oct 6, 2021 that will close this issue
@TheCodeTraveler TheCodeTraveler removed the help wanted This proposal has been approved and is ready to be implemented label Oct 12, 2021
@tnassour
Copy link

Hello, i made the modifications but i can't push them

@TheCodeTraveler
Copy link
Collaborator Author

Thanks @tnassour!

Let's have you make a new branch and open a new PR, then. And we'll close this PR once yours has been opened 👍

@TheCodeTraveler TheCodeTraveler removed this from the v1.0.0 milestone Apr 15, 2022
@vhugogarcia
Copy link
Contributor

Hello @brminnick ,

Thanks to .NET MAUI 7+ and .NET MAUI Community Toolkit Avatar, we are able to develop a badge view very easily by using the following approaches:

  • Labels
  • MCT Avatar View

Find below samples using a simple grid and adding the elements on the same row and column, but just positioning them with the help of VerticalLayout and some minor margins and they are compatible with all platforms.

image image image

So, by saying that, I believe we can close this issue and focus on other features that can grant more benefits and are complex to develop.

Just my grain of salt. 😃 Let me know what you think.

@VladislavAntonyuk VladislavAntonyuk added the needs discussion Discuss it on the next Monthly standup label Dec 17, 2023
@bijington bijington removed the needs discussion Discuss it on the next Monthly standup label Feb 1, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Nov 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved This Proposal has been approved and is ready to be added to the Toolkit champion A member of the .NET MAUI Toolkit core team has chosen to champion this feature pending documentation This feature requires documentation proposal A fully fleshed out proposal describing a new feature in syntactic and semantic detail
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants