Home Forums WPF controls Xceed Toolkit Plus for WPF UpDown control Hex; prepend 0x

Tagged: ,

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • ekorpinen
    Participant
    Post count: 1
    #45097 |

    Below is how I am using the control.

    <xctk:LongUpDown Value=”{Binding Path=ReadAddress,StringFormat={}0x{0:X4}}” Minimum=”0″ Maximum=”65535″ Grid.Row=”1″ Grid.Column=”2″ ParsingNumberStyle=”HexNumber” FormatString=”X” Margin=”4″ />`
    `
    In the pic below the Yellow highlighted area represents the rendered control.

    I have two question :
    1) I don’t see support for unsigned value types i.e ushort uint ulong etc… So is using long and bounding the value range the correct means of implementing a ushort 0->65535 control?
    2) And more importantly how can I implement prepending the “0x” to the displayed text as shown in the green circled textbox. The user would not know it’s a hex input field without the “0x”.
    a. In Win forms I have subclassed the NumericUpDown and override ValidateEditText and UpdateEditText I cannot find equivalent methods.

    Hex UpDown

    Diane [Xceed]
    Moderator
    Post count: 1353

    Hi ekorpinen,

    The unsigned value types (ULongUpDown, UShortUpDown, UIntegerUpDown and SByteUpDown) are included in the Toolkit. They will be available in the v3.6 version, which is currently planned for release in early January 2018.

    The next versions to be release are:
    – v3.6 for Plus users
    – v3.3 for Community users

    The Community version is always 2-3 versions behind the Plus version.
    Until the next release, you are using the LongUpDown/ShortUpDown the correct way to simulate a ULongUpDown/UShortUpDown.

    For Hex values, try removing the StringFormat in the binding and only use the FormatString property set to “{}0x{0:X4}”

       <xctk:LongUpDown Value="{Binding Path=ReadAddress}"
                        Minimum="0"
                        Maximum="65535"
                        FormatString="{}0x{0:X4}"
                        ParsingNumberStyle="HexNumber"
                        Margin="4" />

    I’m not sure what the UpdateEditText() and ValidateEditText() do in WinForms, but based on their documentation:
    – ValidateEditText: Validates and updates the text displayed in the spin box
    – UpdateEditText: Displays the current value of the spin box in the appropriate format.

    In the Toolkit for WPF, NumericUpDowns have OnValueChanged and OnTextChanged, which can be overriden, to detect or validate a text change or a value change.
    – the FormatString property is available to set the appropriate text format.
    – the Text property contains the current text value in the spin box.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.