Too many merge fields to display properly

2 posts, 1 answers
  1. Kenneth
    Kenneth avatar
    104 posts
    Member since:
    Apr 2014

    Posted 31 Aug 2014 Link to this post

    I have 86 merge fields, so when I click on the RibbonUI's  'Insert Merge Field ' button it displays a list of my fields and it runs off the bottom of the browser window.  There is no scroll bar or any way to scroll through the list of available merge fields.

    My only alternative if this is the behavior would be to take over the command and display my own list, then have code insert the merge filed at the current caret position.

    Is there a way to allow the user to scroll through this list?
  2. Answer
    Petya avatar
    989 posts

    Posted 03 Sep 2014 Link to this post

    Hello Kenneth,

    There is no way to show a scroll in the drop-down when the amount of fields is larger. You could modify the behavior however, all you need to do is remove the command binding and handle the button's Click event. The default implementation looks like this and you can modify it in any way you see fit.
    private void AddMergeFieldsInDropDownContent(RadRibbonDropDownButton radRibbonDropDownButton)
        StackPanel stackPanel = new StackPanel();
        foreach (string fieldName in this.radRichTextBox.Document.MailMergeDataSource.GetColumnNames())
            RadRibbonButton fieldButton = new RadRibbonButton()
                Text = fieldName,
                Size = ButtonSize.Medium,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                HorizontalContentAlignment = HorizontalAlignment.Left
            fieldButton.Command = this.radRichTextBox.Commands.InsertFieldCommand;
            fieldButton.CommandParameter = new MergeField() { PropertyPath = fieldName };
        stackPanel.Width = 140;
        radRibbonDropDownButton.DropDownContent = stackPanel;
    private void insertMergeFieldButton_Click(object sender, RoutedEventArgs e)
        AddMergeFieldsInDropDownContent(sender as RadRibbonDropDownButton);

    I hope this is useful.

    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