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
=
"SectionsNavigationMode"
Value
=
"None"
/>
<!--https://www.telerik.com/forums/how-do-i-make-it-possible-for-a-user-to-tab-immediately-out-of-the-masked-text-input-->
<
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
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
Hi Dimitar,
FilterPasse is initialized as an empty string: FilterPasse = "";
Regards,
Hans
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
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
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
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
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
Hi Peter,
initializing the property with string.empty does the job. Thanks.
Regards,
Hans