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

Padding Ignored for RadListVisualItem

1 Answer 86 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
David asked on 27 Aug 2019, 05:02 AM

I have a custom visual item class derived from RadListVisualItem. My custom visual item is being created in the CreatingVisualListItem event, but the "Padding" property is ignored. I've tried Margin, as well, but no luck. My class is below. What am I missing?


public class CustomVisualItem : RadListVisualItem
DockLayoutPanel mainContainer;
StackLayoutElement leftColumn;
StackLayoutElement rightColumn;
LightVisualElement titleElement;
LightVisualElement photoElement;

private ImagePrimitive image;
public ImagePrimitive Image
return this.image;

protected override Type ThemeEffectiveType
return typeof(RadListVisualItem);

protected override void CreateChildElements()

mainContainer = new DockLayoutPanel();
leftColumn = new StackLayoutElement();
rightColumn = new StackLayoutElement();
photoElement = new LightVisualElement();
titleElement = new LightVisualElement();

mainContainer.LastChildFill = true;

leftColumn.Orientation = Orientation.Vertical;
photoElement.DrawBorder = true;
photoElement.Shape = new CircleShape();
photoElement.BackColor = Color.Transparent;
photoElement.BackColor2 = Color.Transparent;
photoElement.BackColor3 = Color.Transparent;
photoElement.BackColor4 = Color.Transparent;
photoElement.AutoSize = false;

rightColumn.Orientation = Orientation.Vertical;
titleElement.Padding = new Padding(50);
titleElement.AutoSize = false;
titleElement.DrawBorder = true;
titleElement.BorderBoxStyle = Telerik.WinControls.BorderBoxStyle.FourBorders;
titleElement.BorderLeftWidth = 0;
titleElement.BorderTopWidth = 1;
titleElement.BorderRightWidth = 0;
titleElement.BorderBottomWidth = 0;

DockLayoutPanel.SetDock(leftColumn, Telerik.WinControls.Layouts.Dock.Left);
DockLayoutPanel.SetDock(rightColumn, Telerik.WinControls.Layouts.Dock.Right);
leftColumn.NotifyParentOnMouseInput = true;
rightColumn.NotifyParentOnMouseInput = true;
titleElement.NotifyParentOnMouseInput = true;
photoElement.NotifyParentOnMouseInput = true;

1 Answer, 1 is accepted

Sort by
Dess | Tech Support Engineer, Principal
Telerik team
answered on 27 Aug 2019, 11:38 AM

Hello, David,  

Note that when you set the AutoSize property to false for a certain element, it is necessary to specify its Size property. Otherwise, it won't be sized correctly and it will remains with size 0

According to the provided sample code snippet I have prepared a sample project for your reference demonstrating how to construct a custom visual item in RadCheckedDropDownList and apply some padding to an inner element in the item. The below screenshot illustrates the achieved result. Note that this is just a sample approach and it may not cover all possible cases. Feel free to extend it in a way which suits your requirements best.

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Dess | Tech Support Engineer, Sr.
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Asked by
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question