# InfoBadge

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-controls/struct-infobadge/

**struct** · [`ferroui-controls`](/docs/0.5.0/api/ferroui-controls/) · v0.5.0

```rust
struct InfoBadge
```

A small badge that draws attention to an item (WinUI's `InfoBadge`): a dot, an icon or a
number.

A `value` of 0 or more is shown as a number and takes precedence over the
`icon_source`; with the value -1 (the default) the badge shows the icon of
its icon source, and a dot without one. The control sets the states of WinUI as
pseudo-classes, which the control theme of the WinUI theme
(`src/FerroUI.Themes.WinUI/Controls/InfoBadge.xaml`) styles: `:dot`, `:icon`, `:font-icon`
(an icon of a [`FontIconSource`](/docs/0.5.0/api/ferroui-controls/struct-fonticonsource/)) and `:value` (DisplayKindStates). The template binds the
number to `value` and the icon and the corner radius to the
`template_settings`. The Fluent and Simple themes have no template
for it (docs/porting/winui-controls.md, section 5.1).

Differences from WinUI (docs/porting/winui-controls.md, section 10.2): a value below -1 is
coerced to -1 and logged, where WinUI throws; whether `CornerRadius` is local is followed from
the priority of its changes.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/info_badge.rs#L43)

## Members

- [`TYPE`](#assoc_const-type)
- [`to_ref`](#function-to_ref)
- [`value_property`](#function-value_property)
- [`icon_source_property`](#function-icon_source_property)
- [`template_settings_property`](#function-template_settings_property)
- [`construct`](#function-construct)
- [`new`](#function-new)
- [`value`](#function-value)
- [`set_numeric_value`](#function-set_numeric_value)
- [`icon_source`](#function-icon_source)
- [`set_icon_source`](#function-set_icon_source)
- [`template_settings`](#function-template_settings)

<a id="assoc_const-type"></a>

### TYPE

```rust
const TYPE: &'static $crate::TypeInfo
```

The runtime type of this class.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/info_badge.rs#L49)

<a id="function-to_ref"></a>

### to_ref

```rust
fn to_ref(self: &Self) -> $crate::Ref<InfoBadge>
```

Returns a strong reference to this object.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/info_badge.rs#L49)

<a id="function-value_property"></a>

### value_property

```rust
fn value_property() -> &'static StyledProperty<i32>
```

Defines the `Value` property: the number the badge shows when it is 0 or more; -1 (the
default) shows the icon or the dot. A value below -1 is coerced to -1.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/info_badge.rs#L108)

<a id="function-icon_source_property"></a>

### icon_source_property

```rust
fn icon_source_property() -> &'static StyledProperty<Option<Ref<IconSource>>>
```

Defines the `IconSource` property: the icon the badge shows when its value is -1.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/info_badge.rs#L108)

<a id="function-template_settings_property"></a>

### template_settings_property

```rust
fn template_settings_property() -> &'static DirectProperty<InfoBadge, Ref<InfoBadgeTemplateSettings>>
```

Defines the `TemplateSettings` property: the values the template binds to (read-only).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/info_badge.rs#L108)

<a id="function-construct"></a>

### construct

```rust
fn construct() -> Self
```

Creates the class data; see `ferroui_base::FerroObject::construct`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/info_badge.rs#L142)

<a id="function-new"></a>

### new

```rust
fn new() -> Ref<Self>
```

Creates an info badge.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/info_badge.rs#L151)

<a id="function-value"></a>

### value

```rust
fn value(self: &Self) -> i32
```

Gets the number the badge shows (-1: the icon or the dot).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/info_badge.rs#L156)

<a id="function-set_numeric_value"></a>

### set_numeric_value

```rust
fn set_numeric_value(self: &Self, value: i32)
```

Sets the number the badge shows (-1: the icon or the dot). `set_value` is the setter of
properties of the object, so the setter of `Value` has this name.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/info_badge.rs#L162)

<a id="function-icon_source"></a>

### icon_source

```rust
fn icon_source(self: &Self) -> Option<Ref<IconSource>>
```

Gets the icon source.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/info_badge.rs#L167)

<a id="function-set_icon_source"></a>

### set_icon_source

```rust
fn set_icon_source(self: &Self, value: Option<Ref<IconSource>>)
```

Sets the icon source.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/info_badge.rs#L172)

<a id="function-template_settings"></a>

### template_settings

```rust
fn template_settings(self: &Self) -> Ref<InfoBadgeTemplateSettings>
```

Gets the values the template binds to; each badge has its own.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/info_badge.rs#L177)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`TemplatedControlImplExt`](/docs/0.5.0/api/ferroui-controls/primitives/trait-templatedcontrolimplext/)
- [`ControlImplExt`](/docs/0.5.0/api/ferroui-controls/trait-controlimplext/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- [`Receiver`](/docs/0.5.0/api/ferroui-system/task/oneshot/struct-receiver/)
- `Any`
- [`InputElementImplExt`](/docs/0.5.0/api/ferroui-base/input/trait-inputelementimplext/)
- [`InteractiveImplExt`](/docs/0.5.0/api/ferroui-base/interactivity/trait-interactiveimplext/)
- [`LayoutableImplExt`](/docs/0.5.0/api/ferroui-base/layout/trait-layoutableimplext/)
- [`FerroObjectImplExt`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimplext/)
- [`StyledElementImplExt`](/docs/0.5.0/api/ferroui-base/trait-styledelementimplext/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- [`VisualImplExt`](/docs/0.5.0/api/ferroui-base/trait-visualimplext/)
- `ErasedDestructor`
- `IntoEither`
- `Deref`
- [`Upcast<T>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`Upcast<InfoBadge>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`StaticType`](/docs/0.5.0/api/ferroui-base/trait-statictype/)
- [`ObjectType`](/docs/0.5.0/api/ferroui-base/trait-objecttype/)
- [`Subclassable<T>`](/docs/0.5.0/api/ferroui-base/trait-subclassable/)
- [`DefaultConstructible`](/docs/0.5.0/api/ferroui-base/trait-defaultconstructible/)
- [`StyledElementImpl`](/docs/0.5.0/api/ferroui-base/trait-styledelementimpl/)
- [`VisualImpl`](/docs/0.5.0/api/ferroui-base/trait-visualimpl/)
- [`InteractiveImpl`](/docs/0.5.0/api/ferroui-base/interactivity/trait-interactiveimpl/)
- [`InputElementImpl`](/docs/0.5.0/api/ferroui-base/input/trait-inputelementimpl/)
- [`ControlImpl`](/docs/0.5.0/api/ferroui-controls/trait-controlimpl/)
- [`FerroObjectImpl`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimpl/)
- [`LayoutableImpl`](/docs/0.5.0/api/ferroui-base/layout/trait-layoutableimpl/)
- [`TemplatedControlImpl`](/docs/0.5.0/api/ferroui-controls/primitives/trait-templatedcontrolimpl/)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
