Skip to content

FreakyChip

Gulam Ali H edited this page Dec 30, 2023 · 3 revisions

FreakyChip Class

FreakyChip is a ContentView representing a customizable chip control with optional text, icons, and selection state.

Properties

FontAttributes

  • Type: FontAttributes
  • Description: Gets or sets the font attributes for the text displayed in the chip.

FontAutoScalingEnabled

  • Type: bool
  • Description: Gets or sets whether automatic font scaling is enabled for the text in the chip. The default value is true.

FontFamily

  • Type: string
  • Description: Gets or sets the font family for the text in the chip.

FontSize

  • Type: double
  • Description: Gets or sets the font size for the text in the chip.

TextDecorations

  • Type: TextDecorations
  • Description: Gets or sets the text decorations for the text in the chip.

Text

  • Type: string
  • Description: Gets or sets the text content of the chip.

TextTransform

  • Type: TextTransform
  • Description: Gets or sets the text transformation for the text in the chip.

TextType

  • Type: TextType
  • Description: Gets or sets the text type for the chip.

VerticalTextAlignment

  • Type: TextAlignment
  • Description: Gets or sets the vertical text alignment within the chip. The default value is TextAlignment.Center.

HorizontalTextAlignment

  • Type: TextAlignment
  • Description: Gets or sets the horizontal text alignment within the chip. The default value is TextAlignment.Center.

SelectedChangedCommand

  • Type: ICommand
  • Description: Gets or sets the command to be executed when the IsSelected property changes.

IsSelected

  • Type: bool
  • Description: Gets or sets the selection state of the chip.

CornerRadius

  • Type: CornerRadius
  • Description: Gets or sets the corner radius for the chip.

SelectedBackgroundColor

  • Type: Color
  • Description: Gets or sets the background color of the chip when it is selected. The default value is Colors.LightGray.

UnselectedBackgroundColor

  • Type: Color
  • Description: Gets or sets the background color of the chip when it is not selected. The default value is Colors.White.

SelectedTextColor

  • Type: Color
  • Description: Gets or sets the text color of the chip when it is selected. The default value is Colors.Black.

UnselectedTextColor

  • Type: Color
  • Description: Gets or sets the text color of the chip when it is not selected. The default value is Colors.Black.

Name

  • Type: string
  • Description: Gets or sets the name of the chip.

SizeRequest

  • Type: double
  • Description: Gets or sets the size request for the chip. Changing this property also updates the size of the chip's icons.

SvgAssembly

  • Type: Assembly
  • Description: Gets or sets the assembly containing SVG resources for the chip's icons.

LeadingResourceId

  • Type: string
  • Description: Gets or sets the resource ID for the leading icon in the chip.

LeadingBase64String

  • Type: string
  • Description: Gets or sets the Base64-encoded string for the leading icon in the chip.

TrailingResourceId

  • Type: string
  • Description: Gets or sets the resource ID for the trailing icon in the chip.

TrailingBase64String

  • Type: string
  • Description: Gets or sets the Base64-encoded string for the trailing icon in the chip.

ImageColor

  • Type: Color
  • Description: Gets or sets the color of the chip's icons. The default value is Colors.Transparent.

AnimationColor

  • Type: Color
  • Description: Gets or sets the color used for chip animation effects. The default value is ControlConstants.DefaultControlRipple.

Padding

  • Type: Thickness
  • Description: Gets or sets the padding for the chip. The default value is a Thickness of 10 on all sides.

Stroke

  • Type: Brush
  • Description: Gets or sets the brush used for drawing the stroke of the chip.

StrokeThickness

  • Type: double
  • Description: Gets or sets the thickness of the stroke for the chip.

Events

SelectedChanged

  • Type: EventHandler<CheckedChangedEventArgs>
  • Description: Raised when the IsSelected property changes.

Methods

FreakyChip

  • Description: Initializes a new instance of the FreakyChip class.

OnSelectedChanged

  • Parameters:
    • bindable: BindableObject
    • oldValue: object
    • newValue: object
  • Description: Handles the change in the IsSelected property, updating visual states, and executing associated commands.

ChangeVisualState

  • Description: Overrides the base class method to change the visual state of the chip based on the selected state.

Remarks

  • The FreakyChip class provides a flexible and customizable chip control with support for text, icons, and selection state.
  • Icons can be provided either as SVG resources in a specified assembly or as Base64-encoded strings.