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
|
Is there a simple way to make NumericTextBox display data as a percentage? For example, we have quite a few places where we need to edit a double (0.0 -> 1.0 range) representing a percentage. It'd be nice to have a simple means of handling this in NumericTextBox, or even a PercentageTextBox control (similar to CurrencyTextBox). I think we could manage to make something via edit templates and a value converter, but I wanted to make sure there wasn't an option that would be simpler before we go down this road. Thanks, Reed |
|
|
No, this isn't built into NumericTextBox, and the formatting features that CurrencyTextBox uses aren't currently exposed to allow you to plumb this in yourself. We could probably make a PercentageTextBox for you pretty easily, but I don't think that would be doing much more than:
The obvious difference is that it would display the percent sign inside the box rather than outside it, and in a culture-sensitive manner -- not sure how important this is to you, but let us know if it's sufficiently important to you! |
|
|
These were, unfortunately, my two main concerns - with the third being consistency (with CurrencyTextBox, etc). This is why I was asking if there was any way to get to the plumbing for handling it. Percentages tend to be something we're using enough, and are already confusing enough to users, that I want to get it right... Anyways, as I said, I think we can make it work, but it would be a very nice feature addition to the editors. |
|
|
Hi Reed, I had a quick look at this and have created a basic PercentageTextBox which will be in the next nightly build. Please take it for a spin and let us know if you run into any problems or feel it does not meet your needs. Please do not assume this first build will necessarily be production-ready -- do give it a good kicking! |
|
|
Ivan, So far, it's working great from a functional standpoint - absolutely perfect. The biggest issue is the visuals don't match any of the other numeric text box visuals... See the attached image for an example. The normal text boxes all get borders, but the percentage one shows up with no border. -Reed |
|
|
Hi Reed, There is a candidate fix in the next nightly build for this issue in the case where the PercentageTextBox is styled with either the generic theme or your own custom style. If you had merged in one of the included themes in WPF Elements the border should be displayed prior to this fix anyway - if the control is borderless in this situation we might have to take another look at it, but it looks to be working on our end now. If you aren't using a theme however tonight's build should solve the problem - let us know how it goes. Regards, Callum |
|
|
Callum, We're not using any theming, which is probably why we're seeing this. We'll upgrade to the next nightly tomorrow, and let you know if it doesn't fix it. Thanks again! -Reed |
|
|
The new nightly took care of the visuals issue. Looks great! We'll let you know if we run into any problems, but so far, this works fantastically. Thanks guys! |
|