Skip to content

Proposal: Provide lightweight styling resources for the glyphs of the NumberBox's spin buttons #2789

@Felix-Dev

Description

@Felix-Dev

Proposal: Provide lightweight styling resources for the glyphs of the NumberBox's spin buttons

Summary

Currently, the glyphs used for the spin buttons of the NumberBox control cannot be easily changed:

In order to avoid having to re-template the control or walk the visual tree to change the appearance of these spin buttons, I propose the following theme resources to be added:

  • NumberBoxSpinButtonUpGlyph
  • NumberBoxSpinButtonDownGlyph
  • NumberBoxPopupIndicatorGlyph
  • NumberBoxPopupIndicatorFontSize

See the XAML markup below for an example:

<Application.Resources>
    <x:String x:Key="NumberBoxSpinButtonUpGlyph">&#xE948;</x:String>
    <x:String x:Key="NumberBoxSpinButtonDownGlyph">&#xE949;</x:String>
    <x:String x:Key="NumberBoxPopupIndicatorGlyph">&#xECE8;</x:String>
    <x:Double x:Key="NumberBoxPopupIndicatorFontSize">17</x:Double>
</Application.Resources>

This gives us the following resulting UI:

NumberBox SpinButtonPlacementMode - Inline

image

NumberBox SpinButtonPlacementMode - Compact

image

image

The theme resource NumberBoxPopupIndicatorFontSize is needed here because the custom popup indicator glyph would be too small to identify comfortably with the default FontSize of 12:
image

Rationale

Enable developers to easily style the glyphs of the spin buttons without having to re-template the control.

Important Notes

The theme resources NumberBoxSpinButtonUpGlyph and NumberBoxSpinButtonDownGlyph would have to be set on the app level to take effect in SpinButtonPlacementMode::Compact as they are inside a popup control then.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions