This is a migrated thread and some comments may be shown as answers.

Some basic questions about the MaskedCurrencyInput control

2 Answers 127 Views
MaskedInput (Numeric, DateTime, Text, Currency)
This is a migrated thread and some comments may be shown as answers.
Rod
Top achievements
Rank 1
Rod asked on 28 Aug 2013, 03:44 PM
I'm working with a RadMaskedCurrencyInput control for the first time. It's bound to a SmallMoney column in a SQL Server 2008 R2 Express database, and it's hosted in a WPF DataGrid.

First question, I've removed the underlines, by changing the Placeholder property to " ". That works fine. NOw, how do I remove the thousands separator? Right now it looks a little funny, when there's something like $86.00 in the database. It looks like this: "$ , 86.00" (without the double quotes).

Second (this is more of a question concerning the interaction between the RadMaskedCurrencyInput control and the WPF DataGrid control), how many data templates do I have to specify within the DataGridTemplateColumn? This data grid needs to be able to display data, allow the user to edit the data, delete it and insert new data; basically normal CRUD operations. In order to help I'll show you what the XAML looks like right now:

<DataGridTemplateColumn x:Name="amountEarnedColumn" Header="Amount Earned" Width="SizeToHeader">
    <DataGridTemplateColumn.CellTemplate>
        <DataTemplate>
            <telerik:RadMaskedCurrencyInput Value="{Binding AmountEarned}" Mask="c5.2" Placeholder=" " />
        </DataTemplate>
    </DataGridTemplateColumn.CellTemplate>
    <DataGridTemplateColumn.CellEditingTemplate>
        <DataTemplate>
            <telerik:RadMaskedCurrencyInput Value="{Binding AmountEarned}" />
        </DataTemplate>
    </DataGridTemplateColumn.CellEditingTemplate>
</DataGridTemplateColumn>

Third, the AmountEarned column that is bound to, is not nullable. But $0.00 is a valid value, so how do I specify a default value of $0.00 when the user creates a new row?

2 Answers, 1 is accepted

Sort by
0
Rod
Top achievements
Rank 1
answered on 29 Aug 2013, 08:47 PM
OK, I've made some modifications to the DataGridTemplateColumn that I specified yesterday, and I like it better when displaying the currency data. But I still don't like the way it looks when the user wishes to edit or save a new record with a currency amount here. Here's the definition of the DataGridTemplateColumn that I have now:

<DataGridTemplateColumn x:Name="amountEarnedColumn" Header="Amount" Width="SizeToCells" MinWidth="100">
    <DataGridTemplateColumn.CellTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding AmountEarned, StringFormat={}{0:C}}" />
        </DataTemplate>
    </DataGridTemplateColumn.CellTemplate>
    <DataGridTemplateColumn.CellEditingTemplate>
        <DataTemplate>
            <telerik:RadMaskedCurrencyInput Value="{Binding AmountEarned}"  />
        </DataTemplate>
    </DataGridTemplateColumn.CellEditingTemplate>
</DataGridTemplateColumn>

For example, now when a user creates a new row in the DataGrid and gets to this column the input looks like this:

$___,___,__0.00

I'd rather it just be:

0.00

and allow the user to type in something like 13.00 or 1000.00. I believe I should probably be assigning Mask value, but I tried "C", and that didn't work. What do you suggest?
0
Pavel R. Pavlov
Telerik team
answered on 02 Sep 2013, 10:59 AM
Hi Rod,

In order to achieve your requirements you can set the AutoFillNumberGroupSeparators property to False and the Placeholder to " " (empty string). Please note that with the current implementation of the RadMaskedCurrencyInput control you can not input the number separators when they are needed, only. You are allowed to turn them on and off.

Please give this approach a try and let me know if you need any further assistance.

Regards,
Pavel R. Pavlov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
MaskedInput (Numeric, DateTime, Text, Currency)
Asked by
Rod
Top achievements
Rank 1
Answers by
Rod
Top achievements
Rank 1
Pavel R. Pavlov
Telerik team
Share this question
or