Problem with leading decimal points in grid cell
Syncfusion v10.204.0.75
.Net 4.0, WPF (desktop app) project on Win 8.1
I can't find a combination of flags or column types that will allow this to happen. Using Reflector on Syncfusion's dlls, I can see where the cell eventually calls Double.TryParse() on the string, which fails because it initially just contains this: "." It appears Syncfusions code effectively ignores a leading decimal in a GridDataDoule
Here's what I currently have, and any help would be appreciated.
var column = new GridDataDouleEditVisibleColumn() // note this class is misspelled in my version.
{
HeaderText = "Header",
MappingName = allocColumnName,
Binding = allocBinding, // this binding just adds a value converter that never fires in the case of a leading zero
Width = new GridDataControlLength(54d),
ColumnStyle = new GridDataColumnStyle()
{
Font = new GridFontInfo() { FontWeight = FontWeights.Bold },
IsEditable = true,
MaxLength = 4,
DoubleEdit = new GridDoubleEditStyleInfo()
{
IsScrollingOnCircle = false
},
//CellType = "DoubleEdit",
//CellEditTemplate = new DataTemplate()
NumberFormat = new System.Globalization.NumberFormatInfo()
{
NumberDecimalDigits = 1
},
}
};
Thanks,
Will.
SIGN IN To post a reply.
4 Replies
WR
Will Rogers
December 6, 2013 05:39 PM UTC
Just to be clear on my goal, I'd like to find some way for the grid to either ignore a leading decimal point (but leave it present in the cell), or somehow insert a zero in front of the decimal (e.g., "0.") so the parsing would succeed.
Worst case, I guess I can change what it's bound to to a string, but I think I'd have to change a lot of existing code.
Thanks,
Will.
SM
Saravanan M
Syncfusion Team
December 10, 2013 09:19 AM UTC
Hi
Will,
Sorry
about the delay caused,
We
have analyzed you query and you can display 0 before the decimal value by
setting the particular column type as decimal or double. By default these cell
types shows the 0 before the decimal value. if you type .6 , it will display as
0.6. If this is not your requirement, please modify the attached sample based
on your requirement and share the exact requirement with us? It would be
helpful for us to server you better.
Please
let us know if you need further assistance.
Regards,
Saravanan.M
GridDataControlSample_39939bf2.zip
WR
Will Rogers
December 18, 2013 03:52 PM UTC
Thanks for the reply. I ended up binding to a string property instead and am handling the parsing in the setter for that property. Not ideal but it works.
SM
Saravanan M
Syncfusion Team
December 30, 2013 12:15 PM UTC
Hi Will,
Thanks for your update.
Regards,
Saravanan.M
SIGN IN To post a reply.
- 4 Replies
- 2 Participants
-
WR Will Rogers
- Dec 6, 2013 05:25 PM UTC
- Dec 30, 2013 12:15 PM UTC