Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

Commented Unassigned: NumericUpDown uses the FormatString incorrect [21329]

$
0
0
Line 187 in CommonNumericUpDown.cs
```c#
//Don't know why someone would format a T as %, but just in case they do.
result = FormatString.Contains( "P" )
? _fromDecimal( ParsePercent( text, CultureInfo ) )
: _fromText( text, this.ParsingNumberStyle, CultureInfo );
```

With this line you can not use the Letter "P" in a Format string, even with a leading \ or in literal string delimiter. (" and ')
i think this line should look like this
```c#
result = FormatString.Equals("P",StringComparison.InvariantCultureIgnoreCase)
? _fromDecimal( ParsePercent( text, CultureInfo ) )
: _fromText( text, this.ParsingNumberStyle, CultureInfo );
```
Comments: ** Comment from web user: TrueFuFLeaderG **

Hi,
thanks for the reply.

Extended WPF Toolkit™ Community Edition 2.2.1

I use something like
```c#
"0. 'PV'"
```
as Format string

According to [Microsoft](http://msdn.microsoft.com/de-de/library/0c899ak8(v=vs.110).aspx) this is a valid Format string.


Maybe this is a better solution or we have to specify when we use a custom format string.

```c#

result = Regex.Replace(FormatString, "\\\\.|\"[^\"]*\"|'[^\"]*'", "").ToUpper().Contains( "P" )
? _fromDecimal( ParsePercent( text, CultureInfo ) )
: _fromText( text, this.ParsingNumberStyle, CultureInfo );
```


Viewing all articles
Browse latest Browse all 4964

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>