I want to mask IP address.how to implement?
the following is my implement,but it is failed:
mask :{number:0-255}.{number:0-255}.{number:0-255}.{number:0-255}
input : 10.23.222.12
output:102.322.212. (it is not my expected result)
Hi Daniel,
I just created a small sample to try your mask out and it works for me. I get the expected output. Here's what I'm using to test it out:
<ige:XamMaskedEditor x:Name="maskedEditor" Mask="{}{number:0-255}.{number:0-255}.{number:0-255}.{number:0-255}" /> <TextBox Grid.Row="1" Text="{Binding ElementName=maskedEditor, Path=Value}" />
Basically the text box displays the correct expected value that's entered int the masked editor. Can you provide any more info on any other settings on the masked editor or how you are making use of it? It would be best if you could attach a small sample that demonstrates the issue so we can check it out.
As a side note, try setting the AllowShiftingAcrossSections property to false. You don't have to do it if you are using number sections as you are, but for other textual masks with multiple sections, to prevent text shifting across sections, you would have to set this.
Thanks,
Sandip
Sandip ,
thank you for your comments.I set AllowShiftingAcrossSections property to false,but this issue is still existent.The following is my xaml:
<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 ></RowDefinition> </Grid.RowDefinitions> <Grid.ColumnDefinitions > <ColumnDefinition Width="150"></ColumnDefinition> <ColumnDefinition Width="150"></ColumnDefinition> <ColumnDefinition ></ColumnDefinition> </Grid.ColumnDefinitions> <TextBlock Grid.Row="0" Grid.Column="0" VerticalAlignment="Bottom" HorizontalAlignment="Center">Mask:</TextBlock > <TextBox Name="txtMask" Grid.Row="0" Grid.Column="1" Width="150" VerticalAlignment="Bottom" HorizontalAlignment="Center"/> <TextBlock Grid.Row="1" Grid.Column="0" VerticalAlignment="Bottom" HorizontalAlignment="Center">Test Mask:</TextBlock > <igEditors:XamMaskedEditor Grid.Row="1" Grid.Column="1" VerticalAlignment="Bottom" x:Name="maskedEditor2" ValueType="{x:Type sys:String}" Mask="{Binding ElementName=txtMask ,Path = Text}" DataMode="Raw" DisplayMode="IncludeBoth" AllowShiftingAcrossSections ="False" > <igEditors:XamMaskedEditor.ValueConstraint> <igEditors:ValueConstraint Nullable="True" /> </igEditors:XamMaskedEditor.ValueConstraint> </igEditors:XamMaskedEditor> </Grid></Window>
The problem is that you are setting DataMode to Raw. Raw will strip out any literals ('.' characters) and without the literal character, all sections will lump togather. So don't set the DataMode to Raw. Rather set it to IncludeLiterals. This will preserve the '.' character in the data.
<igEditors:XamMaskedEditor Grid.Row="1" Grid.Column="1" VerticalAlignment="Bottom" x:Name="maskedEditor2" ValueType="{x:Type sys:String}" Mask="{Binding ElementName=txtMask ,Path = Text}" DataMode="IncludeLiterals" DisplayMode="IncludeBoth" AllowShiftingAcrossSections ="False" >
Hope this helps,
How do I get it to save the IP as a 12 digit number without forcing the users to type in every character.
192.168.1.1 should go to 192.168.001.001 in the display and 192168001001 in the database
I tried
otxt.AllowShiftingAcrossSections = False
otxt.PromptChar = "0"
otxt.DataMode = Infragistics.Windows.Editors.MaskMode.Raw
otxt.DisplayMode = Infragistics.Windows.Editors.MaskMode.IncludeBoth
otxt.Mask = "{number:0-255}.{number:0-255}.{number:0-255}.{number:0-255}"
but when tabbing off the control it shifts the singleton 1's across the mask