Hi David
Thanks for contacting Syncfusion Support.
We have checked your query with customizing label text in SfDataForm and your requirement can be achieved by following ways.
Customizing label style and text using DataFormLayoutManager class.
You need to override the GenerateViewForLabel method in DataFormLayoutManager class which is used to customize the label and set it to LayoutManager property of SfDataForm.
Please find the code example.
|
[C#]
dataForm.LayoutManager = new DataFormLayoutManagerExt(dataForm);
public class DataFormLayoutManagerExt : DataFormLayoutManager
{
public DataFormLayoutManagerExt(SfDataForm dataForm) : base(dataForm)
{
}
protected override View GenerateViewForLabel(DataFormItem dataFormItem)
{
var view = base.GenerateViewForLabel(dataFormItem);
var textView = (view as Label);
textView.BackgroundColor = Color.SkyBlue;
textView.TextColor = Color.Blue;
return view;
}
} |
Changing caption for the editor in view:
You can change the caption of editor view by using AutoGeneratingDataFormItem of SfDataForm and Display Attribute.
Please find the code example.
Using AutoGeneratingDataFormItem event.
|
this.dataForm.AutoGeneratingDataFormItem += DataForm_AutoGeneratingDataFormItem;
private void DataForm_AutoGeneratingDataFormItem(object sender, AutoGeneratingDataFormItemEventArgs e)
{
if (e.DataFormItem.Name == "Address")
{
e.DataFormItem.LabelText = "Contact Address";
}
} |
Using Display Attribute.
|
[C#]
[Display(Name ="John Weshly" , ShortName = "John")]
public string Name { get; set; }
|
We have prepared a sample for the same and please find the sample from below link.
Please refer the below link for more details.
Regards,
Jeyasri M.