Style on RadMaskedNumericInput Control

2 posts, 0 answers
  1. Sajid
    Sajid avatar
    12 posts
    Member since:
    Sep 2011

    Posted 03 Nov 2011 Link to this post


    I know its a bit hasty, what i wanted to apply custom style on RadMaskedNumericInput Control and it just not working for me.
    I'm not good at styling but the peice of code given below worked for my default .NET textbox. But when i apply it to RadTextbox it froze the input area, although applies the facny rounded corner and color.

    Please tell me what am i doing wrong here.



    <Style x:Key="TextBox" TargetType="{x:Type my:BaseNumericBox}">



    <Setter Property="SnapsToDevicePixels"


    Value="True" />



    <Setter Property="OverridesDefaultStyle"


    Value="True" />



    <Setter Property="KeyboardNavigation.TabNavigation"


    Value="none" />



    <Setter Property="FocusVisualStyle"


    Value="{x:Null}" />



    <Setter Property="MinWidth"


    Value="120" />



    <Setter Property="MinHeight"


    Value="20" />




    <Setter Property="AllowDrop"


    Value="true" />




    <Setter Property="Template">






    <ControlTemplate TargetType="{x:Type my:BaseNumericBox}">






    <Border Name="Border"












    <SolidColorBrush Color="{DynamicResource TextBoxControlLightColor}" />









    <SolidColorBrush Color="{DynamicResource TextBoxBorderMediumColor}" />









    <VisualStateGroup x:Name="CommonStates">



    <VisualState x:Name="Disabled">






    <ColorAnimationUsingKeyFrames Storyboard.TargetName="Border"






    <EasingColorKeyFrame KeyTime="0"


    Value="{DynamicResource TextBoxDisabledControlLightColor}" />












    <VisualState x:Name="Normal">






    <ColorAnimationUsingKeyFrames Storyboard.TargetName="Border"






    <EasingColorKeyFrame KeyTime="0"


    Value="{DynamicResource TextBoxControlLightColor}" />












    <VisualState x:Name="ReadOnly">






    <ColorAnimationUsingKeyFrames Storyboard.TargetName="Border"






    <EasingColorKeyFrame KeyTime="0"


    Value="{DynamicResource TextBoxDisabledControlDarkColor}" />













    <VisualState x:Name="MouseOver" />









    <ScrollViewer Margin="0"


    x:Name="PART_ContentHost" />


















    <Condition Property="IsFocused" Value="False"></Condition>



    <Condition Property="Text" Value=""></Condition>















    <Trigger Property="IsFocused" Value="True">



    <!--<Setter Property="BorderThickness" TargetName="BorderBase" Value="2.4,2.4,1,1"></Setter>-->






    <Trigger Property="IsEnabled" Value="False">



    <Setter Property="Foreground" Value="DimGray" />



    <!--<Setter Property="FontStyle" Value="Italic" />-->





















  2. Tina Stancheva
    Tina Stancheva avatar
    3299 posts

    Posted 08 Nov 2011 Link to this post

    Hi Sajid,

    In order to modify the default style of the RadMaskedNumericInputControl you'll have to edit its default ControlTemplate. You can find more info here. Also, please keep in mind that you'll have to keep the required elements of the template like the DisplayText and Content elements as they represent the content  of the MaskedNumericInput and in order to properly function, the control needs them.

    I attached a sample project where I slightly modified the ControlTemplate of the RadMaskedNumericInput using the sample style you sent. Let me know if it helps.

    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top