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
134
XamMaskedEditor can't accept SPACE correctly
posted

Hi,

I overwrite the TextBox Template using XamMaskedEditor. But I can't input a string like "A B C D" which contains SPACE in the overwrited TextBox.

e.g.

Input : A B C D   (in Test Mask TextBox,see the following code please)

output: ABCD     (observed in Check Value TextBox,see the following code please)

My expected output is:A B C D 

How to solve this issue?Thank you!

The following code is my a tool to test mask type:

 <Window x:Class="MaskTypeTest.Window2"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"
    xmlns:igEditors="http://infragistics.com/Editors"
    Title="Mask Test" Height="300" Width="500">
    <Grid>
        <Grid.RowDefinitions >
            <RowDefinition ></RowDefinition>
            <RowDefinition Height="30"></RowDefinition>
            <RowDefinition Height="30"></RowDefinition>
            <RowDefinition Height="30"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions >
            <ColumnDefinition Width="150"></ColumnDefinition>
            <ColumnDefinition Width="150"></ColumnDefinition>
            <ColumnDefinition ></ColumnDefinition>
        </Grid.ColumnDefinitions>
      <!-- Input Mask-->
        <TextBlock Grid.Row="0" Grid.Column="0" VerticalAlignment="Bottom" HorizontalAlignment="Center">Mask:</TextBlock >
         <TextBox Name="txtMask" Grid.Row="0" Text="CCCCCCCC" Grid.Column="1" Width="150" VerticalAlignment="Bottom" HorizontalAlignment="Center"/>
      
      <!-- Input value to check the effect of the mask-->
         <TextBlock Grid.Row="1" Grid.Column="0" VerticalAlignment="Bottom" HorizontalAlignment="Center">Test Mask:</TextBlock >
         <TextBox Name="Text1" Grid.Row="1" Grid.Column="1" VerticalAlignment="Bottom" > 
            <TextBox.Template>
                <ControlTemplate>
                    <igEditors:XamMaskedEditor Mask="{Binding ElementName=txtMask ,Path = Text}"
                                               Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Text,Mode=TwoWay}"
                                                ValueType="{x:Type sys:String}"
                                                DataMode="IncludeLiterals"
                        DisplayMode="IncludeBoth"
                        AllowShiftingAcrossSections ="False"

                                              
                                               >
                      <igEditors:XamMaskedEditor.ValueConstraint>
                        <igEditors:ValueConstraint Nullable="True" />
                      </igEditors:XamMaskedEditor.ValueConstraint>
                    </igEditors:XamMaskedEditor>

                </ControlTemplate>
            </TextBox.Template>
            </TextBox>

      <!-- Observe the value in Text1-->
      <TextBlock Grid.Row="2" Grid.Column="0" VerticalAlignment="Bottom" HorizontalAlignment="Center">Check Value:</TextBlock >
      <TextBox Name="Text2" Grid.Row="2" Grid.Column="1" VerticalAlignment="Bottom" Text="{Binding ElementName=Text1 ,Path = Text}">
      </TextBox>
    </Grid>
</Window>

  • 138253
    Offline posted

    Hello Daniel,

    Thank you for your post. I have been looking through it and it seems like that the XamMaskedEditor and the TextBox has some conflict, when you use the XamEditor as a template of the TextBox, so I suggest you use the XamMaskedEditor standalone, because it is practically like a TextBox, but with additional functionality. Please note, we are making efforts to ensure all posts are addressed by an Infragistics expert. We believe that the other community members could benefit from this thread as well.

    Feel free to write me if you need further assistance.