4 Answers, 1 is accepted
0
Hello,
DataFormDataField does not expose a property that limits the text length, however, you can customize the field's Content by setting the nested TextBox's MaxLength property. Please check the article on Customized Fields for some additional info on this matter.
Regards,
Dimitrina
Telerik
DataFormDataField does not expose a property that limits the text length, however, you can customize the field's Content by setting the nested TextBox's MaxLength property. Please check the article on Customized Fields for some additional info on this matter.
Regards,
Dimitrina
Telerik
See What's Next in App Development. Register for TelerikNEXT.
0
Bassam
Top achievements
Rank 1
answered on 14 Apr 2015, 01:45 PM
Thanks.
It worked but dealing with the alignments didn't' make it viable.
<
telerik:DataFormDataField
Label
=
"Bid Name"
DataMemberBinding
=
"{Binding Name, Mode=TwoWay}"
Description
=
"Enter Bid Name"
/>
<
telerik:DataFormDataField
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
TextBlock
Text
=
"Name"
></
TextBlock
>
<
TextBox
Text
=
"{Binding SaveLocation}"
MaxLength
=
"50"
></
TextBox
>
</
StackPanel
>
</
telerik:DataFormDataField
>
0
Bassam
Top achievements
Rank 1
answered on 14 Apr 2015, 02:06 PM
This is the solution that I came with:
I created a Custom Field.
public
class
DataFormTextField : DataFormDataField
{
private
TextBox _textBox =
null
;
public
int
MaxLength
{
get
;
set
;
}
protected
override
System.Windows.DependencyProperty GetControlBindingProperty()
{
return
TextBox.TextProperty;
}
protected
override
System.Windows.Controls.Control GetControl()
{
DependencyProperty dependencyProperty =
this
.GetControlBindingProperty();
ContentControl content =
new
ContentControl();
_textBox =
new
TextBox();
if
(
this
.MaxLength > 0)
{
_textBox.MaxLength =
this
.MaxLength;
}
if
(
this
.DataMemberBinding !=
null
)
{
var binding =
this
.DataMemberBinding;
_textBox.SetBinding(dependencyProperty, binding);
}
content.Content = _textBox;
return
content;
}
}
0
Hi,
Thank you for sharing the solution you implemented with the community.
Regards,
Dimitrina
Telerik
Thank you for sharing the solution you implemented with the community.
Regards,
Dimitrina
Telerik
See What's Next in App Development. Register for TelerikNEXT.