This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I wanted to use the NumericTextBox in the DataGridColumn.EditorTemplate so I could impose min and max values and restrict to valid numeric values. However I am getting strange behavior when the user enters data without first entering edit mode by clicking in the highlighted cell. The demo is very simple--I just attached the XAML and cs files. It displays a grid where the second column uses NumericTextBox in the EditingTemplate. To observe the problem, click once in the top cell of the second column so it is selected (but not yet in edit mode). This cell initially displays "5.01". Type a "3" (for instance) and observe the cell displays the "3" (as expected). Type a "4" and observe the cell now displays "54.01" (not as expected). If you continue to type additional digits get inserted before the decimal. Peter |
|
|
Hello Peter Thanks for pointing out this issue. This will be resolved in the next nightly build. Jason Fauchelle |
|
|
Hi Jason, Thanks for the fix. I noticed something else strange with the NumericTextBox and the DataGrid, so I thought I would continue this thread. With RangeConstraintMode="OnLostFocus" the Minimum and Maximum values are not being enforced at the completion of editing, and the outside-of-range values get save back to the bound data source and displayed after edit mode exits. If you subsequently re-renter edit mode the value gets constrained then. You can see this if you change the DataTemplate from my earlier post to
Just enter an out-or-range value and observe. I strongly suspect the reason this happens is that the editor gets destroyed before it can impose the contraint "OnLostFocus". I am making another post on this topic because it effects my use of some other editors as well. Peter |
|
|
Hello Peter I have included a much more reliable way to force any editor to lose focus before switching the templates back to display mode. This fix will be available in the next nightly build. Jason Fauchelle |
|
|
Hi Jason, I now see the constraints being imposed at completion of editing, as expected. Thanks for the fix. Peter |
|