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

RadImageItem Image Size

3 Answers 306 Views
Rotator
This is a migrated thread and some comments may be shown as answers.
Developer Developer
Top achievements
Rank 1
Developer Developer asked on 17 Sep 2010, 01:58 PM
I'd like for images within a RadImageItem to resize as the RadRotator resizes.  Does anyone know how to do this?  

Any help would be greatly appreciated.  Thank you!

3 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 23 Sep 2010, 09:16 AM
Hi,

Thank you for this question.

Currently this feature is not implemented in RadRotator. However, you can achieve this with a few lines of code. Please consider the following code snippet:
private void Form1_Load(object sender, EventArgs e)
{
    foreach (RadItem item in this.radRotator1.Items)
    {
        RadImageItem imageItem = item as RadImageItem;
        if (imageItem != null)
        {
            LightVisualElement lve = new LightVisualElement();
            lve.Image = imageItem.Image;
            lve.ImageLayout = ImageLayout.Stretch;
            lve.ZIndex = 1000;
            lve.StretchHorizontally = true;
            lve.StretchVertically = true;
            imageItem.Children.Add(lve);
        }
    }
}

I hope this helps. If you need further assistance, do not hesitate to ask.

Sincerely yours,
Jack
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Omair
Top achievements
Rank 2
answered on 10 Oct 2011, 08:04 PM
Dear Telerik Team

The given code is not working in my web application, RadItem and RadImageItem is not defined classes. 
please help, how can i stretch images in a RadRotator in web application. 

regards
0
Slav
Telerik team
answered on 13 Oct 2011, 09:22 AM
Hello Omair,

In case you want to stretch an image inside the ItemTemplate of a RadRotator according to the size of its items, please apply the CSS properties width:100% and height:100% to the image and add the following code snippet in the head section of your page:
<style type="text/css">
    .rrClipRegion .rrItemsList .rrItem div
    {
        width: 100%;
        height: 100%;
    }
</style>

For you convenience I have attached a sample page, implementing the suggested solution. You can use it as a base for your further development.

Note that you have posted your problem in the WinForms section of the forums and you are clearly using the RadRotator for ASP.NET AJAX. Please use this section in order to report future problems and difficulties with the control.

Best wishes,
Slav
the Telerik team

Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.

Tags
Rotator
Asked by
Developer Developer
Top achievements
Rank 1
Answers by
Jack
Telerik team
Omair
Top achievements
Rank 2
Slav
Telerik team
Share this question
or