I have an editable field with XamNumericEditor, width is Auto and mask is rather long, about 17 digits., something like ###,###,###,###,#00.00. When a value is small enough to fit in a cell, all is okay. When I click in the cell, the whole column resizes to accommodate the whole mask. But When a number in a cell is big, the cell does not resize when the grid is displayed, higher digits are cut off and when I click in a cell, it does not resize, just scrolls the mask to the left and displays the last two digits on the left side of the cell and most of the cell is empty. I reckon the field needs resizing to make the whole number fit in, but still have an auto width. I tried calling PerformAutoSize on the problematic field, but it did not help. Anybody has an idea what to do? Thanks.
Ivan
Hi Stefan,
I extracted my classes and used them in your example and it still works fine. So I guess the problem is anything added to the grid in our application. I will have to concentrate on that and I think we can close this conversation. Thank you for your help.
Hello Ivan,
I am glad that you were able to resolve your issue with the resizing. As for your other question, I am not completely sure that I understand your requirement, but I can say that there is no event that fires earlier that you can use to set the properties you want.
so your example works, I only had to change Mask= to Format=, but the resizing is okay. Probably I should have started with the following, but it did not seem important at the time. We use a derivative of XamNumericEditor and setting the Mask and Format properties in OnInitialized method of the editor. I am guessing it's too late then. We use a shortcut class NumericField, which is a derivative of Field with a few properties, so we can define a field as follows:
<NumericField Name="Age" Width="Auto" FormatType="DecimalSeparated" Label="Age" />
FormatType is an enum with predefined formatting that is then translated into Mask and Format during OnInitialized of the editor. Our editor is linked to the field using Settings.EditorType of the NumericField. So the question is, what is the earliest possibility to set those 2 properties before OnInitialized? Now the editor goes to Host (CellValuePresenter) and then to Field (cast to NumericField) to access the FormatType. Maybe it can be done sooner from the Field end and not editor's?
I am going to look at your sample code now. I was doing something else and put this problem on a side for a while.
I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.