Skip to content

CornerRadius with IntegerUpDown #1773

Description

@Maxim-Paluh

I tried different ways to modify IntegerUpDown to get rounded edges.
Here are my observations:
IntegerUpDown -> CommonNumericUpDown -> NumericUpDown -> UpDownBase -> InputBase -> InputBase -> Control

NumericUpDown has a Style that indicates that the control consists of a ButtonSpinner x:Name="PART_Spinner" and a WatermarkTextBox x:Name="PART_TextBox"
(in the NumericUpDown class it is specified that [TemplatePart( Name = PART_TextBox, Type = typeof( TextBox ) )])
Everything is clear here

WatermarkTextBox -> AutoSelectTextBox -> TextBox
WatermarkTextBox also has its own Style and defines a new Template for it.
I've been trying to change different Templates in different places throughout the day, but I still can't get the result I want
1

Activity

  1. XceedBoucherS commented on Mar 4, 2024

    @XceedBoucherS
    Collaborator

    Hi,
    From what I can see, there is no direct way to modify the CornerRadius of a NumericUpDown.
    We will try to add a property to easily modify this.

    In the meantime, if you have access to the source code, here's how a CornerRadius can be set:
    In file Xceed.Wpf.Toolkit/ButtonSpinner/Themes/Aero2.NormalColor.xaml,
    In style targeting : x:Type local:ButtonSpinner, in the ControlTemplate for x:Type local:ButtonSpinner,
    The first Border can have a CornerRadius of 10:
    image
    This will force a 10 CornerRadius on the 4 sides, but only visible on the lest side since the Up/Down buttons are over the right part.

    Then, in the same ControlTemplate, the RepeatButton PART_IncreaseButton has a set style : remove it. then add it's style with a TopRight corner radius of 10:
    image

    In the same way, for PART_DecreaseButton, you can remove its style and add a new one with a bottomRight Corner Radius:
    image

    The "chrome" namespace could be used as
    image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions