Clear all existing items

2 posts, 0 answers
  1. Developer Developer
    Developer Developer avatar
    34 posts
    Member since:
    Sep 2005

    Posted 30 Sep 2010 Link to this post

    I'm attempting to clear the items from an existing RadRotator, and replace them with new ones.  Does anyone know if the example below the correct way to do this, or what the best way would be?  Any help would be greatly appreciated.  Thank you!

    // add first image to rotator
    RadImageItem image = new RadImageItem();
    image.Image = Image.FromStream(imageBuffer);
    radRotator1.Items.Add(image);

    // clear existing items so we can add new ones
    radRotator1.Items.Clear();

    // add a differrent image to the rotator
    RadImageItem image2 = new RadImageItem();
    image2.Image = Image.FromStream(imageBuffer2);
    radRotator1.Items.Add(image2);
    radRotator1.Items.
  2. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 05 Oct 2010 Link to this post

    Hello Developer,

    Thanks for the writing.

    Your approach is correct - you can remove an existing item and add a brand new item containing another image.

    It is also possible to change only the image of the existing item, for example:

    image2.Image = Image.FromStream(imageBuffer2);
    ((RadImageItem)radRotator1.Items[0]).Image = image2;

    I hope this will help. Do not hesitate to contact us if you have other questions.

     

    Sincerely yours,
    Peter
    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
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top