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

RadListControl with 2 images

3 Answers 243 Views
ListControl
This is a migrated thread and some comments may be shown as answers.
Franco
Top achievements
Rank 1
Franco asked on 05 Aug 2011, 10:28 AM

Hello,
In my software I made a window similar to the toolbox of Visual Studio. Inside it I displayed (in a RadListControl) the various elements that can be used in the program. For each item I display an icon and a name that identify the object.
Now I was asked to display another image after the object name, so the item in list must be composed of Image-Text-Image.
Can I do something like this with the RadListControl?
if I can't, what other control I could use to achieve what I have been asked?

thanks for the help, bye!

3 Answers, 1 is accepted

Sort by
0
Accepted
Peter
Telerik team
answered on 10 Aug 2011, 03:55 PM
Hi Franco,

Thank you for writing.

To achieve the desired layout you should insert an ImagePrimitive in the RadListVisualItem. Further, subscribe for the VisualItemFormatting event and set appropriate images for all items. For your convenience, this suggestion is implemented in the attached sample project. 

I hope this helps. Let me know if you have further questions.

Regards,
Peter
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
Michael
Top achievements
Rank 1
answered on 03 Mar 2013, 06:37 PM
Nevermind... Can't remove post though...
0
Peter
Telerik team
answered on 05 Mar 2013, 02:46 PM
Hi Michael,

Thank you for writing back.

RadDropDownList is virtualized control and a few visual items (for example 5 - 8) represent many logical items. This means that you should clear the image if the Text does not ends with "6":
if (visualItem.Text.EndsWith("6"))
{
    ImagePrimitive imagePrimitive = (ImagePrimitive)visualItem.Children[0];
    imagePrimitive.Padding = new Padding(0, 0, 5, 0);
    imagePrimitive.Alignment = ContentAlignment.MiddleRight;
    imagePrimitive.Image = Resources.Icon;
}
else
{
    ImagePrimitive imagePrimitive = (ImagePrimitive)visualItem.Children[0];
    imagePrimitive.Padding = new Padding(0, 0, 0, 0);
    imagePrimitive.Alignment = ContentAlignment.MiddleRight;
    imagePrimitive.Image = null;
}

I hope this helps. Regards,
Peter
the Telerik team
WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Join us for a FREE webinar to see all the new stuff in action.

Interested, but can’t attend? Register anyway and we’ll send you the recording.
Tags
ListControl
Asked by
Franco
Top achievements
Rank 1
Answers by
Peter
Telerik team
Michael
Top achievements
Rank 1
Share this question
or