<
telerik:RadMaskedNumericInput
x:Name
=
"Units"
EmptyContent
=
"Enter Total Units"
InputBehavior
=
"Insert"
SelectionOnFocus
=
"SelectAll"
TextMode
=
"PlainText"
Mask
=
"#####"
Margin
=
"3"
Grid.Column
=
"3"
Grid.Row
=
"2"
/>
Thanks
7 Answers, 1 is accepted
The EmptyContent string is visualized when the Value property of the control is null. It is set to null when you click the clear button. However, initially the Value is 0. In order to show the EmptyContent string you can set the Value of the control to null in its Loaded event handler.
Please give this approach a try and let us know if it works for you.
Regards,
Pavel R. Pavlov
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
Thats one of the moments i really don't like telerik controls.
I bind the value to a object that gives back NULL. Then you set the Element to 0. And then i have to reset it to null. In a dialogue made entirely by dynamic elements i cannot address directly because they have no name. In a dialogue where the elements can either be 0 or null. In MVVM, where i have to write a behavior class just to catch the Loaded Handler just to connect the field to its value AGAIN.
And then... after doing all this... the default EmptyText is BLACK while it is grey on other input fields like "radwatermarkinput". Now i have to change the emptycontenttemplate just to display it in the same color.
This is more work than doing it without telerik.
Please find attached a sample project demonstrating a MaskedNumericInput control having its Value bound to a nullable double property of the ViewModel. It has it's value initially set to null and the EmptyContent message is properly displayed. In the sample there is also a TextBlock with Text bound to maskedinput's control Value property just to assure that its value is null. Could you update the project so the issue you have becomes reproducible or simply attach a runnable copy of yours. As this is a forum thread you should use a third party web site for files sharing or submit a support ticket regarding this inquiry.
As for the EmptyContent text color, what is the theme you have been using? We try to keep our themes consistent and I will gladly forward this to our developers.
Regards,
Peshito
Telerik
This does not work with RadMaskedCurrencyInput. Try:
<
Window
x:Class
=
"NumericInputValueBinding.MainWindow"
xmlns
=
"http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x
=
"http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
Title
=
"MainWindow"
Height
=
"350"
Width
=
"525"
>
<
Grid
>
<
StackPanel
>
<
telerik:RadMaskedCurrencyInput
x:Name
=
"Units"
Value
=
"{Binding TestValue, Mode=TwoWay}"
EmptyContent
=
"Enter Total Units"
Mask
=
""
FormatString
=
"c"
/><
TextBlock
Text
=
"VALUE: "
/><
TextBlock
Text
=
"{Binding Value, ElementName=Units}"
/></
StackPanel
></
Grid
></
Window
>
The Value type of RadMaskedCurrenctyInput is decimal. Simply change the type of the property you have bound to, to be nullable decimal instead of nullable double.
Hope this helps.
Regards,
Peshito
Telerik
Using telerik:RadMaskedNumericInput
Trying to display a Number with up to 3 decimal places ... With AutoFillZeros set to false.. I still get a value with .000..
EmptyContent="Item" InputBehavior="Replace" AutoFillZeros = "False" AutoFillNumberGroupSeparators="False" FormatString="n3"
Mask="" TextMode="PlainText"
Value="{Binding Value}"
AutoFillZeros is by default False for the RadMaskedNumericInput but is designed for scenarios with non-empty Mask.
To change the decimal places after the decimal point you need to play with the FormatString and change it dynamically - N0, N1, N2 etc. We have an SDK sample demonstrating such approach. Could you please take a look and let us know if it gives you a good starting point ?
MaskedInput: Dynamic Format String
Regards,
Petar Mladenov
Progress Telerik