This is a migrated thread and some comments may be shown as answers.

RadMaskedTextInput - literal shown twice

8 Answers 29 Views
MaskedInput (Numeric, DateTime, Text, Currency)
This is a migrated thread and some comments may be shown as answers.
Hans
Top achievements
Rank 1
Veteran
Hans asked on 07 Nov 2019, 11:13 AM

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

8 Answers, 1 is accepted

Sort by
0
Dimitar Dinev
Telerik team
answered on 11 Nov 2019, 05:17 PM

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.
0
Hans
Top achievements
Rank 1
Veteran
answered on 12 Nov 2019, 10:56 AM

Hi Dimitar,

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

Regards,
Hans

 
0
Petar Mladenov
Telerik team
answered on 12 Nov 2019, 04:39 PM

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.
0
Hans
Top achievements
Rank 1
Veteran
answered on 13 Nov 2019, 03:48 PM

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

0
Petar Mladenov
Telerik team
answered on 18 Nov 2019, 07:47 AM

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.
0
Hans
Top achievements
Rank 1
Veteran
answered on 03 Dec 2019, 03:00 PM

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

0
Accepted
Petar Mladenov
Telerik team
answered on 04 Dec 2019, 02:11 PM

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.
0
Hans
Top achievements
Rank 1
Veteran
answered on 04 Dec 2019, 03:42 PM

Hi Peter,

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

Regards,
Hans

Tags
MaskedInput (Numeric, DateTime, Text, Currency)
Asked by
Hans
Top achievements
Rank 1
Veteran
Answers by
Dimitar Dinev
Telerik team
Hans
Top achievements
Rank 1
Veteran
Petar Mladenov
Telerik team
Share this question
or