I think i'm missing something obvious...
I want to have some friendly names on my mail merge fields. (namely spaces in the field names)
So i have a class for instance
This is the only way i know to get "Friendly" names in the dropdown
that is the mail merge.
So the two fields turn up okay as :
"This is the complex description of the field"
but only anothercomplexfield actually populates with data when you do the merge.
Am i going to have to template the raddropdownbutton that holds the mail merge fields?
Is there an example of this somewhere?
Also a sub question. How do i add a scroll bar??
4 Answers, 1 is accepted
With the default MergeFields, it is not possible to change the display name fragment of the field in order to achieve a more friendly look. This should be possible if you implement a custom MergeField by deriving from the MergeField class. Here is a sample implementation that shows how this can be done:
Note that the fragment that is shown when the DisplayMode is Code cannot be changed.
As for your other question, you can change the content of the dropdown button to show the friendly name of the fields and to include a scrollbar in the following way:
1. First, remove the binding of the button to the InsertMergeFieldEmptyCommand from XAML and give it a name (e.g. insertMergeField).
2. Next, add the following code in code-behind:
You can, of course optimize the code of the GetFriendlyName method and add it in a way that will be available by both classes.
I hope this helps. Greetings,
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
I read your reply, but it would help if you could attach example to this thread, so instead of asking tons of questions we could figure it out from the working code.
Attached is the demo project you requested which uses the code from Iva's post. The demo also shows how you can wire a custom field to RadRichTextBox's predefined UI.
I hope you will find it useful.