SfDataForm Lablel TextSize.

Can I change the size of the label text. ?

1 Reply

SV Srinivasan Vasu Syncfusion Team March 26, 2018 06:03 AM UTC

Hi Piotr, 
 
Thanks for contacting Syncfusion support. 
 
We have checked your query with “Changing Label text size in SfDataForm” and you can achieve your requirement by overriding the GenerateViewForLabel method in DataFormLayoutManager which is used to customize the label. 
 
Please refer the below code. 
 
    this.dataForm.LayoutManager = new DataformItem(this.dataForm); 
        
    public class DataformItem: DataFormLayoutManager 
    { 
        public DataformItem(SfDataForm dataForm):base(dataForm) 
        { 
 
        } 
 
        protected override View GenerateViewForLabel(DataFormItem dataFormItem) 
        { 
            var view = base.GenerateViewForLabel(dataFormItem); 
            // Based on condition, you can customize the label for particular item also 
            if (dataFormItem.Name == "FirstName") 
           // Here, you can change Label attributes  
                  (view as Label).FontSize = 30;          
 
             return view; 
        } 
    } 
 
 
We have prepared a sample as per your requirement. Please find the same from below 
 
 
Regards, 
Srinivasan 


Loader.
Up arrow icon