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

adding other controls to Ribbon Bar Design Time

6 Answers 53 Views
RibbonBar
This is a migrated thread and some comments may be shown as answers.
Claude
Top achievements
Rank 1
Claude asked on 05 Jul 2014, 04:22 PM
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#)?

6 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 09 Jul 2014, 02:29 PM
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.
 
0
Claude
Top achievements
Rank 1
answered on 09 Jul 2014, 03:50 PM
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;
0
Claude
Top achievements
Rank 1
answered on 09 Jul 2014, 04:06 PM
per above.  event handler is added, but is not triggered.

trackbar.ValueChanged += new EventHandler(trackbar_ValueChanged);
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 14 Jul 2014, 09:46 AM
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.
 
0
Tasos
Top achievements
Rank 1
answered on 10 Sep 2014, 06:30 AM
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
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 12 Sep 2014, 03:18 PM
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.
 
Tags
RibbonBar
Asked by
Claude
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Claude
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Tasos
Top achievements
Rank 1
Share this question
or