Unexpected Extra Padding Visible Despite Margin and Padding Set to Zero in Layout - Branched from F196309

Mike-E

Hi Arul,

Thank you again for your excellent support, it is greatly appreciated.  You have answered the two first questions for me, thank you for that.  For the third question, please be aware that the image I provided earlier have both Margin + Padding set to 0 and there appears to still be padding as demonstrated.  Is there another setting I should be aware of to remove the area denoted by the red rectangles?

Thank you for any further assistance you can provide.


---------------------------------------------------------------------------------------------------

Hi Mike,

 

You can modify the default padding for data form items by handling the GenerateDataFormItem event in both TextInputLayout and Default layouts. Below is a simple code snippet to achieve this:

 

<sfdf:SfDataForm x:Name="nonWorkingDataForm"

                     DataObject="{Binding Record}"

                     BackgroundColor="White"   

             GenerateDataFormItem="nonWorkingDataForm_GenerateDataFormItem"

                 LayoutType="TextInputLayout"/>

 

 

private void nonWorkingDataForm_GenerateDataFormItem(object sender, GenerateDataFormItemEventArgs e)

{

    if (e.DataFormItem != null)

    {

e.DataFormItem.Padding = new Thickness(0, 5, 0, 5);

    }

}

 

We have also attached a sample for your reference.


Regards,

Arul Jenith B.


Attachment: DataFormSample_3d1c00cf.zip

------------------------------------------------------------------------------------------------------

Hi Arul,

Thank you for your continued assistance and excellent support it is greatly appreciated. The suggestion for the padding worked a bit more, but I am still seeing extra spacing.  Please see the below Xaml and code behind:


Image_4806_1751380124182

Image_2450_1751380154951

This results in the following (note the red rectangles:


Image_1036_1751380205286

Is there another property that allows the control to be flush against the sides as the Hello World Button is?

Thank you for your continued assit



8 Replies 1 reply marked as answer

SR Sri Radhesh Nag Subash Sankar Syncfusion Team July 3, 2025 02:07 PM UTC

Hi Mike,


Thanks for reaching out to us.


We have analyzed that the default behavior of the DataForm includes a padding of 10 on both sides. To remove this padding, you can modify the padding for DataForm items by handling the GenerateDataFormItem event in both TextInputLayout and Default layouts. Below is a simple code snippet to achieve this:


<sfdf:SfDataForm x:Name="nonWorkingDataForm"

                     DataObject="{Binding Record}"

                     BackgroundColor="White"   

             GenerateDataFormItem="nonWorkingDataForm_GenerateDataFormItem"

                 LayoutType="TextInputLayout"/>

 

 

private void nonWorkingDataForm_GenerateDataFormItem(object sender, GenerateDataFormItemEventArgs e)

{

    if (e.DataFormItem != null)

    {

e.DataFormItem.Padding = new Thickness(-10, 5, -10, 5);

    }

}


We have also attached a sample for your reference.


Regards,

Sri Radhesh Nag S



MI Mike-E July 3, 2025 02:13 PM UTC

Hi Sri Radhesh Nag S, thank you for your reply.  If the DataForm has a default padding of 10, then why isn't it impacted when I explicitly set Padding="0" as shown earlier?  What does that padding do if setting it doesn't do anything?

Here it is again for your convenience:

Image_4806_1751380124182


It would seem that if I set this value to 0, along with setting the value to 0 in the code behind, it should be 0 in the display and I shouldn't have to set a negative value for an intuitive value.


Thank you for your consideration and continued assistance.



PM Priyadharshni Murugan Syncfusion Team July 4, 2025 07:03 AM UTC

Hi,


Thank you for the update. As per the current implementation, each DataFormItem within the DataForm has a built-in default left and right padding of 10, which is part of the control's design behavior. Modifying the Padding property of the DataForm itself does not override the internal padding of individual DataFormItem elements.

 
To achieve your desired layout, we recommend setting the padding of each DataFormItem explicitly within the GenerateDataFormItem event. For example, you can use a padding value like (-10, 5, -10, 5) to offset the default padding and align the content as needed.


Please let us know if you need further clarification or assistance.


Regards,
Priyadharshni M



MI Mike-E July 8, 2025 04:03 PM UTC

Hi Priyadharshni, thank you very much for your reply.  I understand that I can set negative values to achieve my desired layout, thank you confirming this.  The issue that I am pointing out to you, however, is that this is the only Syncfusion control that I have used thus far that I have needed to do this.  All others abide by 0,0,0,0 to achieve the equivalent desired layout.

Because of this inconsistency, this seems like a bug with this control.  I hope that is understandable.

Thank you for your consideration.



JM Jeyasri M Syncfusion Team July 9, 2025 11:56 AM UTC

Hi Mike,

# Unexpected Extra Padding Visible Despite Margin and Padding Set to Zero in Layout  

We have logged an issue report for the same; we will fix this issue and include the issue fix in our weekly NuGet release update which is expected to be available by July 29, 2025. We appreciate your patience until then.


You can track the status of this report through the following feedback link: Extra Padding Visible Despite Margin and Padding Set to Zero for Data Form Item in .NET MAUI | Feedback Portal


Note: The provided feedback link is private, and you need to log in to view this feedback.


Disclaimer: Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.


Regards,
Jeyasri M



PM Priyadharshni Murugan Syncfusion Team July 29, 2025 12:04 PM UTC

Hi Mike,

We have fixed the reported issue and included the issue fix in our latest weekly NuGet release update version 30.1.42, which is available for download at nuget.org

Root Cause: The default padding for the item is not ignore when the dataformItem padding is set.

We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you require any further assistance.

Regards,

Priyadharshni M


Marked as answer

MI Mike-E August 6, 2025 09:38 AM UTC

Hi Priyadhasrshni!  Sorry for the delay here, but I wanted to thank you for the update and the fix.  It is greatly appreciated, along with all of your amazing efforts out there.  Thank you so much for listening to your customers and providing outstanding quality to your product. 🙏



PM Priyadharshni Murugan Syncfusion Team August 7, 2025 06:53 AM UTC

Hi Mike,

 

Great to hear the issue has been addressed! We’ll mark this forum as solved now.
If you have any other questions or need help down the line, don’t hesitate to contact us.


Regards,
Priyadharshni M


Loader.
Up arrow icon