DatePicker ReadOnly VisualState

2 posts, 0 answers
  1. B
    B avatar
    74 posts
    Member since:
    Jul 2011

    Posted 17 Jul 2012 Link to this post


    I want all controls to not react visually to IsReadOnly being set, or at least have control over what color is used (so I can make it transparent).

    For controls RadMaskedTextBox and RadMaskedNumericInput there is the following property in the style:

    <SolidColorBrush x:Key="TextBoxBackground_ReadOnly" Color="White"/>

    Removing only the references and leaving the definition works. For example:

    <SolidColorBrush x:Key="TextBoxBackground_ReadOnly" Color="Transparent"/>
    <!--<Setter Property="Background" Value="{StaticResource TextBoxBackground_ReadOnly}"/>--> 
    <!--<VisualState x:Name="ReadOnly">  <Storyboard>  <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="InnerBorder">  <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TextBoxBackground_ReadOnly}"/>  </ObjectAnimationUsingKeyFrames>  </Storyboard> </VisualState>-->


    But I cannot get this to work for RadDatePicker style, what do I need to remove from the default style to not have it react to IsReadonly visually? There doesn't seem to be a VisualState for ReadOnly?



  2. Masha
    Masha avatar
    355 posts

    Posted 18 Jul 2012 Link to this post

    Hello B Demir,

    To modify the ReadOnly apprearance of theTextBox in RadDatePicker,  you should change
    <!-- WatermarkTextBox-->
    <SolidColorBrush x:Key="ControlBackground_ReadOnly" Color="#5EC9C9C9" />
    with the color of your choice.

    I've attached a simple example to demonstrate the approach.

    Hope this helps.

    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft R3 2016 release webinar banner
Back to Top