RadMaskedTextInput - literal shown twice

9 posts, 1 answers
  1. Hans
    Hans avatar
    64 posts
    Member since:
    Nov 2017

    Posted 07 Nov 2019 Link to this post

    Hi,

    I have this RadMaskedTextInput:

    <telerik:RadMaskedTextInput IsClearButtonVisible="True" TextMode="PlainText"  Placeholder=" " Mask="a4/>a3" Margin="2,0,2,0" AcceptsReturn="False" HorizontalAlignment="Stretch" Value="{Binding FilterPasse}" ValueMode="IncludeLiterals" SelectionOnFocus="CaretToBeginning"/>

    Following implicit style is used

    <Style x:Key="DefaultTelerikMaskedTextInputStyle" TargetType="telerik:RadMaskedTextInput" BasedOn="{StaticResource RadMaskedTextInputStyle}">
        <Setter Property="MinHeight" Value="{StaticResource DefaultMinimumHeight}"/>
        <Setter Property="FontFamily" Value="{StaticResource DefaultFont}"/>
        <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}"/>
        <Setter Property="FontWeight" Value="{StaticResource DefaultFontWeight}"/>
        <Setter Property="Validation.ErrorTemplate" Value="{StaticResource ErrorTemplate}"/>
     
        <Style.Triggers>
            <Trigger Property="IsEnabled" Value="True">
                <Setter Property="Background" Value="{StaticResource DefaultTextBoxBackgroundColor}"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Background" Value="{StaticResource DefaultTextBoxDisabledBackgroundColor}"/>
            </Trigger>
            <Trigger Property="IsFocused" Value="True">
                <Setter Property="Background" Value="{StaticResource DefaultTextBoxIsFocusedBackgroundColor}"/>
            </Trigger>
            <Trigger Property="IsReadOnly" Value="True">
                <Setter Property="Background" Value="{StaticResource DefaultTextBoxIsReadOnlyBackgroundColor}"/>
            </Trigger>
        </Style.Triggers>
    </Style>
    <Style TargetType="{x:Type telerik:RadMaskedTextInput}" BasedOn="{StaticResource DefaultTelerikMaskedTextInputStyle}"/>

     

    When running the application the slash (in the mask) is shown twice (see attached pictures). Any ideas why ?

    Regards,
    Hans

  2. Dimitar Dinev
    Admin
    Dimitar Dinev avatar
    72 posts

    Posted 11 Nov 2019 Link to this post

    Hello Hans,

    Thank you for the screenshots and code snippets.

    Could you please tell me what is the initial value of FilterPasse property? This way, we will be better able to reproduce your exact scenario and advice you more precisely.

    Looking forward to your reply.

    Regards,
    Dimitar Dinev
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Hans
    Hans avatar
    64 posts
    Member since:
    Nov 2017

    Posted 12 Nov 2019 in reply to Dimitar Dinev Link to this post

    Hi Dimitar,

    FilterPasse is initialized as an empty string: FilterPasse = "";

    Regards,
    Hans

     
  4. Petar Mladenov
    Admin
    Petar Mladenov avatar
    3142 posts

    Posted 12 Nov 2019 Link to this post

    Hi Hans,

    I tried to replicate your setup as close as possible but wasn't able to reproduce the issue with the doubled literal. Could you please check out my test project and modify it if needed so that the scenario is the same as yours? Thank you in advance.

    Regards,
    Petar Mladenov
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  5. Hans
    Hans avatar
    64 posts
    Member since:
    Nov 2017

    Posted 13 Nov 2019 in reply to Petar Mladenov Link to this post

    Hi Petar,

    I added my control with style to your project but was unable to reproduce the problem.  After some more testing in my own project I noticed the following: I've created 3 custom configuration to be able to switch easily between develop/test/production environment.  The problem with the double slash only occurs when running the application with the develop configuration, test and production are ok.  No idea how this is possible ...

    Regards,
    Hans

  6. Petar Mladenov
    Admin
    Petar Mladenov avatar
    3142 posts

    Posted 18 Nov 2019 Link to this post

    Hi Hans,

    You can try to find a difference between the configurations. You can bind the Value, Text and ViewModel's properties to some TextBlocks in your application or inspect their values with UI inspector (WPF Inspector, Snoop, VS). Also there might be a timing issue between configurations, slowing down the loading process. Also is there any chance, different configurations apply difference Cultures to your application ?

    Regards,
    Petar Mladenov
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  7. Hans
    Hans avatar
    64 posts
    Member since:
    Nov 2017

    Posted 03 Dec 2019 in reply to Petar Mladenov Link to this post

    Hi Petar,

    I finally found the time to get to the bottom of this problem. It has nothing to do with the different configurations I talked about in my previous post.

    I was able to reproduce the problem in your provided test project by simply setting the DataContext of the MainWindow to the Model class. 

    <Window.DataContext>
        <local:Model/>
    </Window.DataContext>

     

    Regards,
    Hans

  8. Answer
    Petar Mladenov
    Admin
    Petar Mladenov avatar
    3142 posts

    Posted 04 Dec 2019 Link to this post

    Hello Hans,

    I managed to reproduce this issue in my project by commenting the initialization of DataContext in MainWindow.cs and adding the DataContext in XAML as you pointed. The difference is that now the ModelValue has default value of NULL instead of string.empty.  Is it suitable in your business project to use string.empty or valid value (for example "1234/567") as initial model value , instead of null ? This can be achieved with default value initialized in constructor:

        public class Model : ViewModelBase
        {
            public Model()
            {
                this.ModelValue = "";
            }

    Regards,
    Petar Mladenov
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  9. Hans
    Hans avatar
    64 posts
    Member since:
    Nov 2017

    Posted 04 Dec 2019 in reply to Petar Mladenov Link to this post

    Hi Peter,

    initializing the property with string.empty does the job.  Thanks.

    Regards,
    Hans

Back to Top