You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NumericUpDown: When Changing String Format From Hexadecimal To Any Other Non-Hexadecimal String Format, The Input Will Always Be Parsed As Hexadecimal
#4499
Open
BenMendel opened this issue
Jul 1, 2024
· 0 comments
Once you changed the "StringFormat" property from hexadecimal format to any different format, the property "ParsingNumberStyle" will be set on "HexNumber" and cannot be changed. This causes for decimal numbers to be parsed as hexadecimal.
Enter the text "10", then hit "Enter" to update the value
Right click in the textbox, hit the "Hex" button, the "10" text is changed to "0xA" (the "Value" property remained the same - 10).
Right click in the textbox, hit the "Hex" button again, the text is changed back to "10"
Enter the text "10", then hit "Enter" to update the value, and the value and the text are changed to "16"
Expected behavior
When the "Hex" is changed from checked to unchecked (I.e., the "StringFormat" property is changed from "{}0x{0:X}" to string.Empty), the parsing should return to normal decimal numbers (I.e., the "ParsingNumberStyle" should also change from "HexNumbers" to "Any"), and not hexadecimals.
E.g., enter the text "10", click enter. I should see the value "10" as the "Value" property.
Actual behavior
Input text is parsed as hexadecimal.
E.g., enter the text "10", click enter. I see the value "16" as the "Value" property.
Environment
MahApps.Metro version: v2.4.10
Windows build number: Win11 Pro 23H2 [OS Build 22631.3810]
Visual Studio: 2022 17.10.3
Target Framework: .Net 7
Screenshots
The text was updated successfully, but these errors were encountered:
Once you changed the "StringFormat" property from hexadecimal format to any different format, the property "ParsingNumberStyle" will be set on "HexNumber" and cannot be changed. This causes for decimal numbers to be parsed as hexadecimal.
Steps to reproduce
Create this control for example:
Expected behavior
When the "Hex" is changed from checked to unchecked (I.e., the "StringFormat" property is changed from "{}0x{0:X}" to string.Empty), the parsing should return to normal decimal numbers (I.e., the "ParsingNumberStyle" should also change from "HexNumbers" to "Any"), and not hexadecimals.
E.g., enter the text "10", click enter. I should see the value "10" as the "Value" property.
Actual behavior
Input text is parsed as hexadecimal.
E.g., enter the text "10", click enter. I see the value "16" as the "Value" property.
Environment
MahApps.Metro version: v2.4.10
Windows build number: Win11 Pro 23H2 [OS Build 22631.3810]
Visual Studio: 2022 17.10.3
Target Framework: .Net 7
Screenshots
The text was updated successfully, but these errors were encountered: