In xamdatapresenter, how can I limit the number of characters in an unbound field? I need a column that will let the user input no more than 8 characters, and don't see any MaxLength type of property.
<
igDP:UnboundField Name="info" Label="User Info" BindingPath="info" BindingMode="TwoWay" />
something like MaxLength="8" ?
Hello,
These properties are set through the editor for that field. There are couple of ways that you can do this. You can either set the ValueConstraint property of the editor or set it's mask property to a value that limits the input. You can find more information on the masks here. These settings you can apply to the field by creating a style for the editor (for example XamNumericEditor) and applying that style to the Field->Settings->EditorStyle property.
Ok i got most of it now. Is there a way to set up the mask for an explicit character though? For example, I'm using this now, but the mask isn't quite what i want. It lets me enter any character in the first position and only alpha in the others, but I really want to allow a period(.) , a slash (/), or alphanumeric character. I don't want user to be able to enter any other special characters, but I do need to allow these two in addition to alphanumeric values in any of the five positions. How can i do this?
Style x:Key="FiveAlphaEditorStyle" TargetType="{x:Type igEditors:XamMaskedEditor}">
<Setter Property="ValueConstraint">
<Setter.Value>
<igEditors:ValueConstraint MaxLength="5" />
</Setter.Value>
</Setter>
<Setter Property="Mask" Value="Caaaa">
</Style>
.
igDP:UnboundField Name="Fix" Label="Fix" BindingPath="Fix" BindingMode="TwoWay" Width="60">
<igDP:Field.Settings>
<igDP:FieldSettings
EditorType="{x:Type igEditors:XamMaskedEditor}"
EditorStyle="{StaticResource FiveAlphaEditorStyle}"
EditAsType="{x:Type sys:String}" />
</igDP:Field.Settings>
</igDP:UnboundField>
In this case, you would have to change the mask and replace the aaa section with a custom section.
For example, below you can see a mask with two sections. The first one is "C" which is what you want and the next one is the one that allows all the digits, all the letters including the dot and slash :
Mask="{}C{char:4:0-9a-zA-Z./}"