How do I... use a user-control which contains the RibbonView with multiple RTB instances?

2 posts, 0 answers
  1. Aron
    Aron avatar
    6 posts
    Member since:
    Aug 2011

    Posted 26 Jan 2012 Link to this post

    I have created a RibbonView from the example on your site, and added it to a user control.  The naming conventions match the example exactly.

    I want to programmatically (using C#) add this control to a grid and have it work with an RTB that is also programmatically added to the grid.  Currently I cannot get them to talk to each other.  I would also like to be able to add multiple RTB's to the page and have the control switch dynamically.  I've seen a demo written for WPF, but as the RibbonView is not within the same context I don't know how to adapt it.

    My example C# is as follows:

    //define an int to be used as a flag if the ribbon has been added.
    private int editorLoaded = 0; 

    while
     (sNodeName == "Tab")
    {
        if
     (editorLoaded == 0)
        {     editorLoaded = 1;
             UI.Controls.xRichTextRibbon xRibbon = new UI.Controls.xRichTextRibbon();
             xRibbon.Margin = new Thickness(15, 15, 15, 15);
             grdEdit.Children.Add(xRibbon);
        }

        RadRichTextBox editor = new RadRichTextBox();
        editor.Document.LayoutMode = Telerik.Windows.Documents.Model.DocumentLayoutMode.Flow;
        editor.Height = 300;
        editor.Margin = new Thickness(15, 115, 15, 15);
        editor.VerticalAlignment = System.Windows.VerticalAlignment.Top;
        editor.IsReadOnly = false;

        grdEdit.Children.Add(editor);
    }
  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 31 Jan 2012 Link to this post

    Hello Aron ,

     I guess you need RadRichTextBoxRibbonUI instead of RibbonView. Could you please check out this demo and its source code and let us know if it helps you ? You can also find this help article useful.
    On a side note, we highly encourage you to use XAML (not c#) when defining your UI.

    Regards,
    Petar Mladenov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
Back to Top