Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
473
Caret is visible even after setting the ReadOnly to true in XamMaskedEditor
posted

Hi,

I am setting XamMaskedEditor's  IsReadOnly property to true. Now if I use mouse to focus on the XamMaskedEditor the caret blinks inside the XamMaskedEditor. Is it the default behavior or a defect.
If I use the XamTextEditor the caret is not visible inside the XamTextEditor.

Please find a sample attached here.

Steps to reproduce -

1. Run the application.
2. Click on the XamMaskedEditor using mouse.
3. The caret blinks inside the XamMaskedEditor.

Regards,

Sachin

WpfStudy.zip
  • 27093
    posted

    Hello Sachim,

     

    I have been looking into your issue and I can see what you mean. I guess that this is so, since there isn’t much point in using a mask editor for a  readonly field. Nevertheless I found a way for you to hide the caret when the masked editor is readonly. I have made this code snippet based on the sample project you had uploaded:

     

    <igEditors:XamMaskedEditor Width="100" Margin="5" IsReadOnly="True" EditModeStarting="mask_EditModeStarting"  VerticalAlignment="Top" Name="mask"  HorizontalAlignment="Left" PromptChar="" >

        <igEditors:XamMaskedEditor.Resources>

            <Style TargetType="{x:Type igEditors:CaretElement}">

                <Style.Triggers>

                    <DataTrigger Binding="{Binding  RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type igEditors:XamMaskedEditor}}, Path=IsReadOnly}" Value="true">

                        <Setter Property="Background" Value="Transparent" />

                    </DataTrigger>

                </Style.Triggers>

            </Style>

        </igEditors:XamMaskedEditor.Resources>

    </igEditors:XamMaskedEditor>

     

    Please let me know if I can assist you further on the matter.

     

    Sincerely,

    Petar Monov

    Developer Support Engineer

    Infragistics Bulgaria

    www.infragistics.com/support