adding other controls to Ribbon Bar Design Time

7 posts, 0 answers
  1. Claude
    Claude avatar
    63 posts
    Member since:
    Apr 2009

    Posted 05 Jul 2014 Link to this post

    I whish to add a track bar or range selector to a group in a Ribbon bar at design time.  I cannot figure out how to do this.  Optionally, how would I do this with Code(C#)?
  2. Dimitar
    Admin
    Dimitar avatar
    1414 posts

    Posted 09 Jul 2014 Link to this post

    Hello Claude,

    Thank you for writing.

    Currently, at design time you can add the most common elements that are available in the design time drop down (see the attached image). Other elements can be added with code. For example you can add RadTrackBarElement in range mode as follows:
    RadTrackBarElement trackbar = new RadTrackBarElement();
    trackbar.TrackBarMode = TrackBarRangeMode.Range;
    trackbar.Minimum = 20;
    trackbar.Maximum = 120;
    trackbar.Ranges[0].Start = 50;
    trackbar.Ranges[0].End = 90;
     
    trackbar.Padding = new System.Windows.Forms.Padding(3);
    radRibbonBarGroup1.Items.Add(trackbar);

    Also I want to ask you what is your exact scenario. I am asking you this since RadRangeSelector is a different control with different purpose and I am not sure that you want to add it to the ribbon?

    I hope this helps. I am looking forward to your reply.
     
    Regards,
    Dimitar
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Claude
    Claude avatar
    63 posts
    Member since:
    Apr 2009

    Posted 09 Jul 2014 in reply to Dimitar Link to this post

    I was looking at both controls for different purposes.  More trying to understand how to do this.  I am looking at using the TrackBar as a zoom control.  However, I cannot seem to add an event handler.  I have tried this to no avail.

    trackbar.ValueChanged += trackbar_ValueChanged;
  5. Claude
    Claude avatar
    63 posts
    Member since:
    Apr 2009

    Posted 09 Jul 2014 in reply to Claude Link to this post

    per above.  event handler is added, but is not triggered.

    trackbar.ValueChanged += new EventHandler(trackbar_ValueChanged);
  6. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 14 Jul 2014 Link to this post

    Hello Claude,

    Thank you for writing back.

    When in TrackBarRangeMode.Range it is allowed to have several ranges. Due to the complexity of scrolling in this case, the appropriate event to use is Ranges.CollectionChanged instead of the ValueChanged event:
    RadTrackBarElement trackbar = new RadTrackBarElement();
    RadTrackBarElement trackbar2 = new RadTrackBarElement();
     
    public Form1()
    {
        InitializeComponent();
        
        trackbar.TrackBarMode = TrackBarRangeMode.Range;
        trackbar.Minimum = 20;
        trackbar.Maximum = 120;
        trackbar.Ranges[0].Start = 50;
        trackbar.Ranges[0].End = 90;
     
        trackbar.Padding = new System.Windows.Forms.Padding(3);
        radRibbonBarGroup1.Items.Add(trackbar);
        trackbar.Ranges.CollectionChanged += Ranges_CollectionChanged;
         
        trackbar2.TrackBarMode = TrackBarRangeMode.SingleThumb;
     
        trackbar2.Padding = new System.Windows.Forms.Padding(3);
        radRibbonBarGroup2.Items.Add(trackbar2);
        trackbar2.ValueChanged += trackbar2_ValueChanged;
    }
     
    private void Ranges_CollectionChanged(object sender,
        Telerik.WinControls.Data.NotifyCollectionChangedEventArgs e)
    {
        Console.WriteLine("Trackbar1 start range : " + trackbar.Ranges[0].Start);
        Console.WriteLine("Trackbar2 end range : " + trackbar.Ranges[0].End);
    }
     
    private void trackbar2_ValueChanged(object sender, EventArgs e)
    {
        Console.WriteLine("Trackbar2 : " + trackbar2.Value);
    }

    I hope this information helps. If you have any additional questions, please let me know.

    Regards,
    Desislava
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  7. Tasos
    Tasos avatar
    9 posts
    Member since:
    Dec 2012

    Posted 10 Sep 2014 in reply to Dess Link to this post

    Hi
    it will a great help if we can add custom controls and labels at design time. I think that if we can have at design time an element like a panel then we can add into it from designer any control we wish.

    Best regards
  8. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 12 Sep 2014 Link to this post

    Hello Tasos,

    Thank you for writing.

    RadRibbonBar control has a specific content structure. Its design time supported content elements are similar to the available ones in MS Word which introduces the standard office UI. It is possible to create a more flexible and custom UI depending on the specific requirements adding elements at run time only. 

    I hope this information helps. Should you have further questions, I would be glad to help.

    Regards,
    Desislava
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top
UI for WinForms is Visual Studio 2017 Ready