AllowShiftingAcrossSections Property

Specifies whether to shift characters across section boundaries when deleting characters. Default value is True.
Public Property AllowShiftingAcrossSections As Nullable(Of Boolean)
public Nullable<bool> AllowShiftingAcrossSections {get; set;}

This property controls what happens to the characters in the following sections when one or more characters are deleted in the current section. For example, in a simple mask like "###-###" where there are two input sections separated by a '-' character. Each input section comprises of three digit placeholders. Let's say the whole mask is currently filled with data. When you delete a character in the first section, this property controls whether the characters from the next input section flow into this section or not.

Continuing from above example, let's say the editor has the following data:
If the caret is located before the character '2' and you hit Delete key, the 2 will be deleted and '3' will be shifted left to occupy the position '2' had occupied. This will happen regardless of the AllowShiftingAcrossSections setting. However what happens after this depends on the value of this property. If AllowShiftingAcrossSections is set to False, the position '3' originally occupied will become empty and the resulting display characters will be as the following:
If AllowShiftingAcrossSections is set to True, characters from the next input section will 'flow' into current input section to fill in the position vacated by '3' when it got shifted left to occpy the position of '2'. Here is how the resulting display characters will look like:

What value you would use for this property depends on the kind of mask that you have. The usability is greatly affected by the value of this property depending on the mask being used. For example, in a Date mask where each section of the date (month, day, year) is a logically distinct value, you would not want to shift values across sections. As a matter of fact, for certain built in masks like date, time etc... shifting across sections can not be enabled even by setting this property to True since that is something that would not be desirable under any circumstance for those masks. However for custom masks, you may want to set this property to a value based on whether it makes sense for that particular mask to shift characters across sections.


Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also