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
60
maxlength setting of a field in xamdatagrid
posted

I am novice in WPF. I am using Xam Datagrid which consists of several fields. I want to set MaxLength field for a below field. How do I set it? User should not be able to enter more than 25 characters. Thanks in advance.

<

igDP:Field Row="1" Column="0" ColumnSpan="12" Label="{rms:LocalizedResource Name=UserName}" Name="UserName">

 <igDP:Field.Settings>

 <igDP:FieldSettings AllowEdit="true" CellMaxWidth="18" LabelTextAlignment = "Left" CellContentAlignment ="LabelLeftOfValueStretch"/>

 

 

</igDP:Field.Settings>

 </igDP:Field>

  • 69686
    Suggested Answer
    posted

    Hello,

    It sounds like you want to set some kind of constraint (length of the text) rather than length of the Field. If that is the case, you should create a style for the value editor - for example XamTextEditor and apply that style at the EditorStyle property of the Field. In this style, you should create a setter for the ValueConstraint property and set some constraints.

    It should look like this:

    <Style TargetType="igEditors:XamTextEditor" x:Key="Style">
                <Setter Property="ValueConstraint">
                    <Setter.Value>
                        <igEditors:ValueConstraint MaxLength="25"/>
                    </Setter.Value>
                </Setter>
            </Style>