We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to set MaxLength to the GridColumns?

You can define MaxLength to the GridColumn in display mode by using DisplayBinding and IValueConverter interface as follows.

C#

 

XAML

 

Note: You can use Converter in Value Binding also as follows.

XAML

 

You can also restrict the MaxLength in edit mode by writing Style to TextBox since MS TextBox will be loaded while editing GridTextColumn.

 

Please refer the below code snippet.

XAML

 

 

The MaxLength can be set for a particular column by deriving a new class from GridCellTextBoxRenderer and override the OnInitializeEditElement method with the help of TextBox.MaxLength property as follows.

C#

 

 

Sample Links:

WPF

WinRT

UWP

Article ID: Published Date: Last Revised Date: Platform: Control:
6031 01/20/2016 01/20/2016 UWP SfDataGrid
Did you find this information helpful?
Add Comment
You must log in to leave a comment

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon