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

RadMaskedTextInput Validation problem

1 Answer 100 Views
MaskedInput (Numeric, DateTime, Text, Currency)
This is a migrated thread and some comments may be shown as answers.
Sergey
Top achievements
Rank 1
Sergey asked on 10 Jun 2013, 12:36 PM
Hello I have a problem with Radmaskedtextinput. If I make a new blank project everything works fine. But in my project validation does not work (. Maybe someone already faced with like. If I comment on their styles and styles are used by default, in my project, too, everything is working properly .... I even took a blend of styles with the default Radmaskedtextinput , but it still does not work if you are using the disclosed styles. basically I need only to remove the yellow edge hover and focus on the field. Can anyone tell me how to remove the border using Codebehind because the disclosure of style validation stops working.
Sorry for my English.

1 Answer, 1 is accepted

Sort by
0
Pavel R. Pavlov
Telerik team
answered on 13 Jun 2013, 11:03 AM
Hello Sergey,

As far as I understand your requirement you want to remove or change the "MouseOver" and "Focused" visual states of the RadMaskedTextInput control. In order to achieve your requirement you can extract and edit the default Template of the control (read more). When you do this you can find a VisualState called "MouseOver" and if you edit it like this:

<VisualState x:Name="MouseOver">
    <Storyboard>
        <!--<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Border" Storyboard.TargetProperty="BorderBrush">
            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ControlOuterBorder_MouseOver}" />
        </ObjectAnimationUsingKeyFrames>-->
        <DoubleAnimation Duration="0"
                         Storyboard.TargetName="ClearButton"
                         Storyboard.TargetProperty="Opacity"
                         To="1" />
    </Storyboard>
</VisualState>
You will disable the ObjectAnimation to change the BorderBrush to Yellow.

Furthermore, you can see that in the "Focused" VisualState the Border called "FocusedVisual" is visualized. In order to make it identical to the default visual state you can edit it like this:

<Border x:Name="FocusedVisual"
     BorderBrush="{TemplateBinding BorderBrush}"
     BorderThickness="1"
     CornerRadius="{StaticResource ControlOuterBorder_CornerRadius}"
     Visibility="Collapsed" />
For your convenience I implemented this approach in the attached project. Please take a look at it and let me know if it fits your scenario.

Regards,
Pavel R. Pavlov
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
MaskedInput (Numeric, DateTime, Text, Currency)
Asked by
Sergey
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
Share this question
or