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

RadMaskedInput Value

5 Answers 162 Views
MaskedInput
This is a migrated thread and some comments may be shown as answers.
codeputer
Top achievements
Rank 2
codeputer asked on 25 Oct 2017, 10:57 PM

Hi,

 

not have any properties of Value or Text?

And why the Displayed only Get?

"DisplayedText: Gets the displayed text.(Read-only)"

 

How can I load data and bind to RadMaskedInput to show data?

Thanks.

5 Answers, 1 is accepted

Sort by
0
Lance | Manager Technical Support
Telerik team
answered on 27 Oct 2017, 05:29 PM
Hi Richard,

The property you're looking for is InputValue. Here's a simple example to demonstrate:

<ContentPage>
    <StackLayout>
        <Label x:Name="OutputLabel" VerticalOptions="Center"/>
 
        <telerikInput:RadMaskedInput x:Name="maskedInput"
                             WatermarkText="Enter Email Address"
                             Mask=".+@[a-zA-Z]+\.[a-zA-Z]+"
                             MaskType="Regex"/>
 
        <Button Text="Get Value" Clicked="Button_OnClicked"/>
    </StackLayout>
</ContentPage>

public partial class StartPage : ContentPage
{
    public StartPage()
    {
        InitializeComponent();
    }
 
    private void Button_OnClicked(object sender, EventArgs e)
    {
        OutputLabel.Text = maskedInput.InputValue;
    }
}


Regards,
Lance | Tech Support Engineer, Sr.
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Jeff
Top achievements
Rank 1
answered on 30 Oct 2018, 09:15 PM
Does InputValue support Binding ?  Nothing in the examples folder shows it...
0
Lance | Manager Technical Support
Telerik team
answered on 30 Oct 2018, 11:10 PM
Hello Jeff,

Yes, it supports data binding. for example:

<input:RadMaskedInput InputValue="{Binding MyInputValue, Mode=TwoWay}" />

Although, this isn't an ideal case for a masked control as the backing value bound to InputValue will be updated regardless of validation.

If you have any trouble implementing the data binding with MaskedInput, please open a support ticket here and share the view mode property and the XAML so that the development team can assist directly.

Regards,
Lance | Tech Support Engineer, Sr.
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Alberto
Top achievements
Rank 1
answered on 12 Feb 2019, 08:12 PM
Is there a way to have the border get read in case of failed validation instead of the message on the bottom? 
0
Lance | Manager Technical Support
Telerik team
answered on 12 Feb 2019, 10:45 PM
Hi Alberto,

This is not yet possible through a built-in but can be easily achieved by hooking into the ApplyMaskFinished and making changes to the UI based on the value of IsInputAccepted

As a mock example, change the BorderStyle:

<input:RadMaskedInput ApplyMaskFinished="RadMaskedInput_OnApplyMaskFinished" InvalidInputErrorText=""/>


private BorderStyle goodBorderStyle = new BorderStyle { BorderColor = Color.Gray, BorderThickness = new Thickness(0,0,0,4)};
private BorderStyle badBorderStyle = new BorderStyle { BorderColor = Color.Red, BorderThickness = new Thickness(0, 0, 0, 4) };
 
private void RadMaskedInput_OnApplyMaskFinished(object sender, ApplyMaskFinishedEventArgs e)
{
    var maskedInput = sender as RadMaskedInput;
 
    maskedInput.BorderStyle = maskedInput.IsInputAccepted ? goodBorderStyle : badBorderStyle;
}

Ultimately, you can take whichever approach works for you the best, the main takeaway is that you can change the style depending on IsInputAccepted, and set the InvalidInputErrorText to an empty string.


Regards,
Lance | Technical Support Engineer, Principal
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
MaskedInput
Asked by
codeputer
Top achievements
Rank 2
Answers by
Lance | Manager Technical Support
Telerik team
Jeff
Top achievements
Rank 1
Alberto
Top achievements
Rank 1
Share this question
or