This is a migrated thread and some comments may be shown as answers.

Margin between checkbox and image

2 Answers 323 Views
CheckedListBox
This is a migrated thread and some comments may be shown as answers.
Marco
Top achievements
Rank 2
Veteran
Marco asked on 11 Mar 2021, 04:54 PM

Hello Telerik,

How could I play with margin and padding to add some spacing between image, texte and certainly my checkboxe ?

Thank you in advance for your support !

2 Answers, 1 is accepted

Sort by
0
Accepted
Nadya | Tech Support Engineer
Telerik team
answered on 12 Mar 2021, 03:43 PM

Hi, Marco,

You can use the VisualItemFormatting event to give more space between elements in SimpleListViewVisualItem. Please refer to the following code snippet:

this.radCheckedListBox1.VisualItemFormatting += this.RadCheckedListBox1_VisualItemFormatting;
private void RadCheckedListBox1_VisualItemFormatting(object sender, ListViewVisualItemEventArgs e)
{
    e.VisualItem.Image = Resources.bul;
    //space between image and text
    e.VisualItem.Layout.LeftPart.Margin = new Padding(0, 0, 15, 0);
    //space between checkbox and image
    ((e.VisualItem as SimpleListViewVisualItem).Children[0] as ListViewItemCheckbox).Padding = new Padding(0, 0, 15, 0);
}

I hope this helps. Should you have other questions do not hesitate to contact me.

Regards,
Nadya
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Marco
Top achievements
Rank 2
Veteran
answered on 12 Mar 2021, 05:03 PM

It's work perfectly !

Thank you very much

Tags
CheckedListBox
Asked by
Marco
Top achievements
Rank 2
Veteran
Answers by
Nadya | Tech Support Engineer
Telerik team
Marco
Top achievements
Rank 2
Veteran
Share this question
or