Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > MaskedTextBox > RadMaskedTextBox IsReadOnly Grey

Not answered RadMaskedTextBox IsReadOnly Grey

Feed from this thread
  • B avatar

    Posted on Nov 18, 2011 (permalink)

    Hi,

    After the recent update to 3.1116 all Rad controls are greyed when IsReadOnly is true. I tried to get around this by setting the ReadOnly style to:
    <VisualState x:Name="ReadOnly"/>
    but I get a COM error HRESULT = EFAIL when  I run the application. Is that not the right way to disable the grey style? Or is there another way apart from setting the style to make RadMaskedTextBox and other controls not appear grey when IsReadOnly = true?

    Regards,
    Bayram

    <

     

    SolidColorBrush x:Key="TextBoxBackground"

    Color="#FFFFFFFF" />

     

    <SolidColorBrush x:Key="ControlOuterBorder_Normal"

    Color="#FF848484" />

     

    <Style TargetType="telerik:RadMaskedTextBox">

     

    <Setter Property="Mask"

    Value="aaaa" />

     

    <Setter Property="MaskType"

    Value="Standard" />

     

    <Setter Property="Foreground"

    Value="{StaticResource ControlForeground_Normal}" />

     

    <Setter Property="BorderBrush"

    Value="{StaticResource ControlOuterBorder_Normal}" />

     

    <Setter Property="BorderThickness"

    Value="1" />

     

    <Setter Property="IsReadOnly"

    Value="False" />

     

    <Setter Property="Placeholder"

    Value="_" />

     

    <Setter Property="MinHeight"

    Value="22" />

     

    <Setter Property="Background"

    Value="{StaticResource TextBoxBackground}" />

     

    <Setter Property="HorizontalContentAlignment"

    Value="Stretch" />

     

    <Setter Property="VerticalContentAlignment"

    Value="Center" />

     

    <Setter Property="Padding"

    Value="2 0" />

     

    <Setter Property="IsTabStop"

    Value="False" />

     

    <Setter Property="Template">

     

    <Setter.Value>

     

    <ControlTemplate TargetType="telerik:RadMaskedTextBox">

     

    <Grid>

     

    <VisualStateManager.VisualStateGroups>

     

    <VisualStateGroup x:Name="CommonStates">

     

    <VisualState x:Name="Normal" />

     

    <VisualState x:Name="ReadOnly"/>

     

    <VisualState x:Name="Disabled">

     

    <Storyboard Duration="0">

     

    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"

    Storyboard.TargetName="DisabledVisual">

     

    <DiscreteObjectKeyFrame KeyTime="0"

    Value="Visible" />

     

    </ObjectAnimationUsingKeyFrames>

     

    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground"

    Storyboard.TargetName="ContentElement">

     

    <DiscreteObjectKeyFrame KeyTime="0"

    Value="{StaticResource ControlForeground_Disabled}" />

     

    </ObjectAnimationUsingKeyFrames>

     

    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground"

    Storyboard.TargetName="PART_ExtendedTextBox">

     

    <DiscreteObjectKeyFrame KeyTime="0"

    Value="{StaticResource ControlForeground_Disabled}" />

     

    </ObjectAnimationUsingKeyFrames>

     

    </Storyboard>

     

    </VisualState>

     

    <VisualState x:Name="MouseOver">

     

    <Storyboard Duration="0">

     

    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush"

    Storyboard.TargetName="InnerBorder">

     

    <DiscreteObjectKeyFrame KeyTime="0"

    Value="{StaticResource ControlOuterBorder_MouseOver}" />

     

    </ObjectAnimationUsingKeyFrames>

     

    </Storyboard>

     

    </VisualState>

     

    </VisualStateGroup>

     

    <VisualStateGroup x:Name="FocusStates">

     

    <VisualState x:Name="Unfocused">

     

    <Storyboard Duration="0">

     

    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"

    Storyboard.TargetName="FocusedVisual">

     

    <DiscreteObjectKeyFrame KeyTime="0"

    Value="Collapsed" />

     

    </ObjectAnimationUsingKeyFrames>

     

    </Storyboard>

     

    </VisualState>

     

    <VisualState x:Name="Focused">

     

    <Storyboard Duration="0">

     

    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"

    Storyboard.TargetName="FocusedVisual">

     

    <DiscreteObjectKeyFrame KeyTime="0"

    Value="Visible" />

     

    </ObjectAnimationUsingKeyFrames>

     

    </Storyboard>

     

    </VisualState>

     

    </VisualStateGroup>

     

    <VisualStateGroup x:Name="EmptyStates">

     

    <VisualState x:Name="NonEmpty" />

     

    <VisualState x:Name="Empty">

     

    <Storyboard Duration="0">

     

    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"

    Storyboard.TargetName="EmptyContentPresenter">

     

    <DiscreteObjectKeyFrame KeyTime="0"

    Value="Visible" />

     

    </ObjectAnimationUsingKeyFrames>

     

    </Storyboard>

     

    </VisualState>

     

    </VisualStateGroup>

     

    <VisualStateGroup x:Name="ValidationStates">

     

    <VisualState x:Name="Valid" />

     

    <VisualState x:Name="InvalidUnfocused">

     

    <Storyboard>

     

    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"

    Storyboard.TargetName="ValidationTooltip">

     

    <DiscreteObjectKeyFrame KeyTime="0"

    Value="Visible" />

     

    </ObjectAnimationUsingKeyFrames>

     

    </Storyboard>

     

    </VisualState>

     

    <VisualState x:Name="InvalidFocused">

     

    <Storyboard>

     

    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"

    Storyboard.TargetName="ValidationTooltip">

     

    <DiscreteObjectKeyFrame KeyTime="0"

    Value="Visible" />

     

    </ObjectAnimationUsingKeyFrames>

     

    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="IsOpen"

    Storyboard.TargetName="ValidationTooltip">

     

    <DiscreteObjectKeyFrame KeyTime="0:0:0">

     

    <DiscreteObjectKeyFrame.Value>

     

    <sys:Boolean>True</sys:Boolean>

     

    </DiscreteObjectKeyFrame.Value>

     

    </DiscreteObjectKeyFrame>

     

    </ObjectAnimationUsingKeyFrames>

     

    </Storyboard>

     

    </VisualState>

     

    </VisualStateGroup>

     

    </VisualStateManager.VisualStateGroups>

     

    <Border x:Name="InnerBorder"

    BorderBrush="{TemplateBinding BorderBrush}"

    BorderThickness="{TemplateBinding BorderThickness}"

    Background="{TemplateBinding Background}"

    CornerRadius="{StaticResource ControlOuterBorder_CornerRadius}">

     

    <Grid>

     

    <Telerik_Windows_Controls_MaskedTextBox:ExtendedTextBox x:Name="PART_ExtendedTextBox"

    Cursor="{TemplateBinding Cursor}"

    Foreground="{TemplateBinding Foreground}"

    HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"

    IsTabStop="True"

    IsReadOnly="{TemplateBinding IsReadOnly}"

    Margin="{TemplateBinding Padding}"

    TabIndex="{TemplateBinding TabIndex}"

    VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" />

     

    <Border x:Name="EmptyContentPresenter"

    IsHitTestVisible="False"

    Visibility="Collapsed">

     

    <ContentControl x:Name="ContentElement"

    ContentTemplate="{TemplateBinding EmptyContentTemplate}"

    Content="{TemplateBinding EmptyContent}"

    Foreground="{TemplateBinding Foreground}"

    FontStyle="Italic"

    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"

    IsTabStop="False"

    Margin="{TemplateBinding Padding}"

    VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />

     

    </Border>

     

    <Telerik_Windows_Controls_Chromes:ValidationTooltip x:Name="ValidationTooltip"

    TooltipPlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"

    telerik:StyleManager.Theme="{StaticResource Theme}"

    TooltipContent="{Binding (Validation.Errors), RelativeSource={RelativeSource TemplatedParent}}"

    Visibility="Collapsed" />

     

    </Grid>

     

    </Border>

     

    <Border x:Name="FocusedVisual"

    BorderBrush="{StaticResource ControlOuterBorder_Focused}"

    BorderThickness="1"

    CornerRadius="{StaticResource ControlOuterBorder_CornerRadius}"

    Visibility="Collapsed" />

     

    <Border x:Name="DisabledVisual"

    BorderBrush="{StaticResource ControlOuterBorder_Disabled}"

    BorderThickness="1"

    CornerRadius="{StaticResource ControlOuterBorder_CornerRadius}"

    Visibility="Collapsed" />

     

    </Grid>

     

    </ControlTemplate>

     

    </Setter.Value>

     

    </Setter>

     

    </Style>

    Reply

  • B avatar

    Posted on Nov 22, 2011 (permalink)

    Hi,

    We use colors in IsReadOnly RadMaskedTextBox and they show as grey too, we need a solution to this for 3.1116 version please.

    We use assignment from codebehind to assign the background:

    view.grondWbb.Background =

     

     

    BodemToetsingUtils.ConvertTextToBackGroundColor(record.Strings["GROND_WBB"]);


    This works for 0.1s but then the control becomes grey again.

    Regards,
    Bayram

    Reply

  • Tina Stancheva Tina Stancheva admin's avatar

    Posted on Nov 23, 2011 (permalink)

    Hi Bayram,

    Clearing the ReadOnly VisualState from the default ControlTemplate of the control is the right way to go. However, I am not sure what is causing the COM error you reported.

    I tried to reproduce it in a sample solution, but I couldn't. Can you please have a look at the attached solution and modify it to reproduce the issue so that we can investigate the cause and help you get over it? Thank you in advance.

    Best wishes,
    Tina Stancheva
    the Telerik team

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

    Reply

  • B avatar

    Posted on Nov 23, 2011 (permalink)

    Hi Tina,

    In the sample application it works, but I still get the COM error with the same style in the real application. I also attached the error dialog we get and the full error message is below.

    The application will run fine up to the moment where I open a RadPane containing such a RadMaskedTextBox, then the COM error appears.

    I went through all the properties of the Telerik dll references and they are all 2011.3.1116.1040, so it's not the case that versions are mixed.

    I tried changing various things in the sample project to make it look more like the real application:
    - added a DataContext + TwoWay databinding to a dependency property
    - upgraded the controls from trial to dev
    - Added a RacDocking, DocumentHost, etc and a RadPane

    But it still worked after that. So it looks like it is some combination of controls that only occurs in the main project, but not something I can think of atm.

    Regards,
    Bayram

    System.CrossAppDomainMarshaledException was unhandled
    Message: System.Exception: Error HRESULT E_FAIL has been returned from a call to a COM component.
       bij SilverlightTest.App.Application_UnhandledException(Object sender, ApplicationUnhandledExceptionEventArgs e)
       bij MS.Internal.Error.CallApplicationUEHandler(Exception e)
       bij MS.Internal.Error.CallAUEHandler(UInt32 hr, UInt32& bIsHandled)
    Attached files

    Reply

  • Tina Stancheva Tina Stancheva admin's avatar

    Posted on Nov 28, 2011 (permalink)

    Hello B,

    I think that the best way to proceed would be to try to isolate your issue in a simplified solution and sent it in a support ticket.

    We usually avoid requiring projects from our customers since the support helps resolving particular issues and it’s out of our scope of service to create or edit our customers’ projects. But in this case due to the fact that we cannot reproduce the issue locally and the provided exception information doesn't help us narrow down the cause for the issue, I believe that we'll be better able to assist you if you try to isolate the issue.

    Also most often than not, the problem is not database–related. And for our DataVisualization controls there should be no difference of the data source used. That means that you can try and populate your control with generics or any other collection that the Framework provides.

    You can try the following simple steps in order to find what is causing the exception or at least strip down your project as much as possible thus narrowing down the cause for the issue:

    1.
     Selecting the right UserControl/Page/Window to work on: Isolate the Page/Window/UserControl where the control is and where the issue occurs. Any other code that is out of the scope of the issue should be removed.
    2. Isolating the reproduction steps: Try isolating the steps that allow you to reproduce the problem in a written list. Make sure that these steps reproduce the problem every time.
    3. Determine which is/are the controls that cause the problem: Often there are only 2 or 3 controls that are directly involved with a given problem. Determine which are the controls that are not related to it. We suggest you to use the ‘remove and try’ approach when it is hard for you to determine what is causing the problem. This means that you should remove parts of the code and check if the issue reproduces without it. Keep doing this till you find the cause for the problem.
    4. Moving in a separate project: Once you have minimized the number of controls that reproduce the problem, copy that UserControl to a new project that uses the same DLLs as your original project. Make sure that the new solution still reproduces the problem. There are cases where the reasons for the problem might be in your project settings (web.config, app.config, etc), so if you cannot reproduce the problem after copying the file, try copying your configuration files as well.

    Greetings,
    Tina Stancheva
    the Telerik team

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

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > MaskedTextBox > RadMaskedTextBox IsReadOnly Grey
Related resources for "RadMaskedTextBox IsReadOnly Grey"

Silverlight MaskedTextBox Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  ]