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
|
When using the DisplayMemberBinding on the DataGridColumn, could the display template set the TextAlignment based on the type of data? Typically numeric data is right-justified, string data is left-justified, etc. I don't know that I necessarily need control of how it's justified (that may be nice, but I could use a custom display template if needed), but I'm hoping that when using the DisplayMemberBinding it justifies the column in the commonly accepted way. Thanks. |
|
|
Hello Jared This is a great idea. We can not set this as the default behavior though as this will change the existing behavior of everyones data grid. We could include an option for this which you could toggle, but this would take some time to rig up, so it's on the back log for now. In the next major version, we may make numeric cells align to the right by default as this is the commonly accepted way. I am wondering, with such option, would you expect the numeric cells to still use a TextBox for editing (but with right justified text)?, or would you want it to be one of our numeric input controls? For now you'll need to use custom templates to get this effect. Jason Fauchelle |
|
|
I was thinking of still using a TextBox, but I've not used your numeric input controls so I don't know the benefits they might offer. Thanks. |
|
|
Hello Jared So you don't need to discover this for yourself, here is a quick run down of the numeric control features. First of all they only accept numeric input, so they don't try to bind string input from the text box back to a numeric property which would cause conversion errors. They provide a way to limit the minimum and maximum numeric value that the user can input. As a basic example, a column could display a rotation value in degrees, so you could limit the input from 0 to 360. The numeric controls also provide numeric formatting such as commas and decimal place rounding. There are both NumericTextBox and IntegerTextBox controls available depending on if you are binding to a double or integer property. There is also a NumericUpDown and IntegerUpDown control which include functionality for increasing or decreasing the value by a specified delta value using either the up/down arrow keys or the provided up/down UI buttons. Optionally, the UI up/down buttons can be hidden. If you have a column displaying a cost, you could use the CurrencyTextBox which includes similar features to the NumericTextBox, plus currency formatting for any culture. If none of these features are really needed, you can continue using a TextBox instead. Jason Fauchelle |
|
|
Thanks Jason for the overview of your other controls. They sound quite promising. I guess to answer your original question, I'd like to see these controls used or at least take a look at the effort required to implement them. If for some unknown reason it is much harder to implement these controls in a performant way, the TextBox will work. |
|
|
Hello Jared The next nightly build will include some support for right aligned numeric cells. It won't set it by default, but you can tell the data grid what cell templates to use by adding TypeEditors to the Editors collection of the DataGrid like this:
The next nightly build will include the IntegerEditorKey and DoubleEditorKey which will cause a right aligned display template and editor template to be used. Also, these will use an IntegerTextBox or NumericTextBox as the editor. The TypeEditors seen in the code above tells the data grid that all Int32 properties and all Double properties should use those templates. This will be in effect whether you are using DisplayMemberBinding or not. Jason Fauchelle |
|
|
This sounds like a great solution! I haven't tried it yet, but I like the concept. Thanks so much! |
|
|
This sounds like a great solution! I haven't tried it yet, but I like the concept. Thanks so much! |
|