binding buttons to ribbon groups

2 posts, 0 answers
  1. rocker
    rocker avatar
    1 posts
    Member since:
    Jul 2017

    Posted 04 Jul 2017 Link to this post


    I am trying to create a ribbon  menu from a json file. Tabs ands groups are being displayed. But buttons are not. instead, the class names of the buttons are displayed as text and they can not be clicked. what could be the reason ? any example of such system would be appreciated.

    so here are my business objects:

    01.public class RibbonTab {
    02.    public string header { getset; }
    03.    public List<RibbonGroup> ribbonGroups { getset; }
    05.  public class RibbonGroup {
    06.    public string header { getset; }
    07.    public List<RibbonButton> ribbonButtons { getset; }
    09.  public class RibbonButton {
    11.    public string text { getset; }
    12.    public string icon { getset; }
    13.    public int size { getset; }
    14.    public string parentPage { getset; }
    16.    public string ButtonText { get return text; } }
    17.    public Telerik.Windows.Controls.RibbonView.ButtonSize ButtonSize
    18.    {
    19.        get         {
    20.            return (Telerik.Windows.Controls.RibbonView.ButtonSize)size;
    21.        }
    22.    }


    here is my view:

    <Style TargetType="{x:Type telerik:RadRibbonButton}">            
    <Setter Property="Text" Value="{Binding ButtonText}" />        
    <Style TargetType="telerik:RadRibbonGroup">            
    <Setter Property="Header" Value="{Binding header}" />            
    <Setter Property="ItemsSource" Value="{Binding ribbonButtons}" />        
    <Style TargetType="telerik:RadRibbonTab">            
    <Setter Property="Header" Value="{Binding header}" />            
    <Setter Property="ItemsSource" Value="{Binding ribbonGroups}" />        


    <telerik:RadRibbonView  ItemsSource="{Binding RibbonTabs}" />

  2. Martin Ivanov
    Martin Ivanov avatar
    2391 posts

    Posted 06 Jul 2017 Link to this post

    Hello Rocker,

    This behavior is expected with every items control in the WPF framework. When you have a data binding scenario where you use the ItemsSource of the control you will also need to define an ItemTemplate. Otherwise, the control will generate its default container and populate it with the result returned from the ToString() method of the business object. 

    You can see how to use RadRibbonView in an data binding scenario in the Paint with MVVM demo.

    Martin Ivanov
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top