host UserControl in Carousel

11 posts, 0 answers
  1. Eli
    Eli avatar
    11 posts
    Member since:
    Feb 2008

    Posted 26 May 2008 Link to this post

    Hi.
    I'm trying to create a TabControl with a movment-change affect between tabs.
    To do this, I need to do 2 things:

    1. Can I put UserControl as the Carousel element?
    2. Can I control the movment path of the carousel? (I just want a horizontal movment, and not circular)

    Thanks.

  2. Peter
    Admin
    Peter avatar
    1132 posts
    Member since:
    Sep 2012

    Posted 26 May 2008 Link to this post

    Hello Eli,

    Thank you for your interest in RadCarousel. We hope you find it a useful addition to our product.

    1) You should add any control in the carousel item using the following code:

                DateTimePicker ctl = new DateTimePicker();
                ctl.AutoSize = false;//switch off MS autolayout functionality
                ctl.MinimumSize = new Size(110,20);
                RadHostItem hostItem = new RadHostItem( ctl );
                this.radCarousel1.Items.Add(hostItem);

    2) For horizontal moving, you should use the Carousel Bezier path with the same Y coordinates.
    For example:

                carouselBezierPath1.AllowRelativePath = false;
                carouselBezierPath1.CtrlPoint1 = new Telerik.WinControls.UI.Point3D(377, 140, 0);
                carouselBezierPath1.CtrlPoint2 = new Telerik.WinControls.UI.Point3D(93, 140, 0);
                carouselBezierPath1.FirstPoint = new Telerik.WinControls.UI.Point3D(25, 140, 0);
                carouselBezierPath1.LastPoint = new Telerik.WinControls.UI.Point3D(435, 140, 0);
                carouselBezierPath1.ZScale = 500;
                this.radCarousel1.CarouselPath = carouselBezierPath1;
                this.radCarousel1.EnableLooping = true;

    If you have additional questions, do not hesitate to contact me.

    Kind regards,
    Peter
    the Telerik team


    Instantly find answers to your questions at the new Telerik Support Center




  3. Eli
    Eli avatar
    11 posts
    Member since:
    Feb 2008

    Posted 26 May 2008 Link to this post

    Thanks, I'll give it a try.

    Great control!

  4. Jon
    Jon avatar
    539 posts
    Member since:
    Apr 2004

    Posted 23 Jun 2008 Link to this post

    Hi..
    How do you assign the Text property to the carousel item, once you add the control to the RadHostItem?
    thanks

  5. Peter
    Admin
    Peter avatar
    1132 posts
    Member since:
    Sep 2012

    Posted 24 Jun 2008 Link to this post

    Hello Jon Elster,

    Thank you for writing.

    Could clarify what you mean by "Text property to the carousel item". Usually, the Text property can be assigned with the code below:

                    RadButtonElement carouselItem = new RadButtonElement();
                    carouselItem.ImageAlignment = ContentAlignment.MiddleCenter;
                    carouselItem.TextAlignment = ContentAlignment.MiddleCenter;
                    carouselItem.DisplayStyle = DisplayStyle.Text;//or ImageAndText
                    carouselItem.TextImageRelation = TextImageRelation.ImageAboveText;
                    carouselItem.ShowBorder = false;

                    carouselItem.Text = "First Item";
                    
                    this.radCarousel1.Items.Add(carouselItem);


    Let me know if I can help you further.

    All the best,
    Peter
    the Telerik team


    Instantly find answers to your questions at the new Telerik Support Center

  6. Jon
    Jon avatar
    539 posts
    Member since:
    Apr 2004

    Posted 24 Jun 2008 Link to this post

    Yes.. that's what I needed... thanks..

  7. petr
    petr avatar
    3 posts
    Member since:
    Mar 2009

    Posted 09 Feb 2010 Link to this post

    Hi
    I have one more question reagarding the discussion above. Features you are describing works great except one small problem Im facing - not able to set up the font properties (size, family, bold and so on).
    Here is the piece of my code:

     

    RadImageButtonElement ribe = new RadImageButtonElement();

     

    ribe.Image =

    Image.FromFile("C:\\Projects\\image.jpg");

     

    ribe.DisplayStyle =

    DisplayStyle.ImageAndText;

     

    ribe.TextImageRelation =

    TextImageRelation.TextAboveImage;

     

    ribe.ShowBorder =

    true;

     

    ribe.Text = produkt.ProductName;

    ribe.TextAlignment =

    ContentAlignment.MiddleCenter;

     

     

    //ribe.Font.Size = 15;

     

    Products_radCarousel.Items.Add(ribe);

    Commented green line didn't works for me - as this property is read only. How can I change the font (font.size for example) in this context?

  8. Nikolay
    Admin
    Nikolay avatar
    1714 posts
    Member since:
    Sep 2012

    Posted 12 Feb 2010 Link to this post

    Hi,

    In Windows Forms you can change a font setting by creating a new Font object, for example:

    RadButtonElement ribe = new RadButtonElement();
    ribe.Font = new Font(ribe.Font.FontFamily, 15, ribe.Font.Style);

    If you have additional questions, feel free to contact me.

    Sincerely yours,
    Nikolay
    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.

  9. Jerome Prunera-Usach
    Jerome Prunera-Usach avatar
    12 posts
    Member since:
    Oct 2009

    Posted 18 Nov 2010 Link to this post

    Hello,

    I am trying to achieve exactly what the topic of the thread is about : include a User Control in the Carousel.
    I have tried to put exactly the code proposed by Peter (from 2008) with no real success :

    DateTimePicker ctl = new DateTimePicker();
    ctl.AutoSize = false;//switch off MS autolayout functionality
    ctl.MinimumSize = new Size(110,20);
    RadHostItem hostItem = new RadHostItem( ctl );
    this.radCarousel1.Items.Add(hostItem);

    The problem I encounter is that if I put that in a loop (4 occurences for example), it will only add two elements and the carousel's rotation and events are not fired anymore.

    What I am trying to achieve is the following :

    for(int i = 0 ; i < maxLength ; ++i)
    {
        MyUserControl ctl = new MyUserControl(param1, param2);
        ctl.AutoSize = false;
        ctl.MinimumSize = new Size(85, 25);
          
        RadHostItem itm = new RadHostItem(ctl);
        this.myCarousel.Items.Add(itm);
    }

    Any help would be highly appreciated as being able to use UserControl in the Carousel would be perfect for the software I am currently designing. (Maybe I am missing the obvious also :) )

    • OS Information : Windows XP x64 (version 2003) SP2
    • Telerik : RadControls for WinForms 2010.3 10.1109
    • Microsoft Visual Studio 2008
    • .NET 3.5

  10. Peter
    Admin
    Peter avatar
    1132 posts
    Member since:
    Sep 2012

    Posted 23 Nov 2010 Link to this post

    Hello Jerome Prunera-Usach,

    Thank you for writing.

    I can confirm this issue. A fix for it will be available in our next release. Your Telerik points have been updated for the feedback. Do not hesitate to contact us if you have other questions.

    Sincerely yours,
    Peter
    the Telerik team

    Get started with RadControls for WinForms with numerous videos and detailed documentation.

  11. Jerome Prunera-Usach
    Jerome Prunera-Usach avatar
    12 posts
    Member since:
    Oct 2009

    Posted 23 Nov 2010 Link to this post

    Thank you for your answer.

Back to Top