I'd like to enable selection toolbar and also customize it to only show the Copy button. I've tried to set the IsSelectionMiniToolbarEnabled to true, just to see the default MiniToolBar but nothing is shown when any text is selected. Can somebody help me?
Thanks
11 Answers, 1 is accepted
In order to use SelectionMiniToolBar and ContextMenu, you need to add a reference to Telerik.Windows.Controls.RichTextBoxUI.
As it comes to customizing the SelectionMiniToolBar, we have a blogpost just for this purpose. You can find it here. Check it out and let us know if you need further assistance.
Best wishes,
Iva
the Telerik team
Is not running in my labtop.
Telerik.Windows.Controls.RichTextBoxUI reference was already added. I've made a very simple new solution, MainPage.xaml code is as follows:
<
UserControl
x:Class
=
"SearchAndHighlight.MainPage"
mc:Ignorable
=
"d"
d:DesignHeight
=
"341"
d:DesignWidth
=
"852"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
>
<
Grid
x:Name
=
"LayoutRoot"
Background
=
"White"
>
<
telerik:RadRichTextBox
IsSpellCheckingEnabled
=
"False"
Name
=
"radRichTextBox"
IsSelectionMiniToolBarEnabled
=
"True"
/>
</
Grid
>
</
UserControl
>
The project has references to the next telerik assemblies:
Telerik.Windows.Controls
Telerik.Windows.Controls.Input
Telerik.Windows.Controls.Navigation
Telerik.Windows.Controls.RibbonBar
Telerik.Windows.Controls.RichTextBoxUI
Telerik.Windows.Documents
Telerik.Windows.Documents.FormatProviders.Xaml
Telerik's assemblies version is 2010.3.1110.1040
Could you please provide a sample project for us to investigate the matter? You are the first person to report such an issue with the selection mini toolbar.
Thank you.
Kind regards,
the Telerik team
Last Friday, I couln't see any SelectionMiniToolbar, even when creating an empty new solution with only one RichTextBox as main page content. Now, It's running in this scenario, but not in my real solution where I'm using RichTextBox in readnly mode inside the ItemTemplate of ListBox control. So, I want to use richt text box as the content of ListBox items, and I want to see the selection mini toolbar each time the user selects text in any richt text box.
Unfortunately, SelectionMiniToolBar cannot be used when RadRichTexBox.IsReadOnly is true. However your proposition will be taken into consideration and selection mini toolbar would be shown regardless of the value of IsReadOnly property - this will be useful in cases like yours, when custom selection mini toolbars contain only commands that preserve document structure.
We will make changes immediately and the features will be available in the next LIB (expected around the beginning of the next week).
Points in your account have been updated in appreciation.
Kind regards,
Boby
the Telerik team
Do you know if the LIB with the updates to make visible SelectionMiniToolbar when RichTextBox is in ReadOnlyMode is already available?
thanks.
Yes, we managed to include these changes in the LIB from 8 Dec, which should be already visible in your Telerik account.
All the best,
Boby
the Telerik team
It's running fine. Just one last question about this. How can I modify the SelectionMiniToolBar animation? It sems that when shownig the SelectionMiniToolbar, a opacity animation is played. I'd like to remove this animation to force the toolbar appearing inmediately.
Thanks.
When you are implementing a custom selection mini toolbar and you do not want to see an animation, you can implement that logic in the SetOpacity() method, which is a part of ISelectionMiniToolBar interface.
If you want to use the default SelectionMiniToolBar, you have to do something similar, as currently, the methods that it exposes are not virtual and cannot be overridden (in case you decide to extend it by inheriting it). We will consider allowing that in the future, but as a workaround, you can create a custom selection mini toolbar that has a default SelectionMiniToolBar as a field. Something like the following code should do the trick:
[Telerik.Windows.Documents.UI.Extensibility.CustomSelectionMiniToolBar]
public
partial
class
ExtendedSelectionMiniToolBar : ISelectionMiniToolBar
{
SelectionMiniToolBar original;
public
ExtendedSelectionMiniToolBar()
{
original =
new
SelectionMiniToolBar();
}
public
double
Height
{
get
{
return
original.Height; }
}
public
void
Hide()
{
original.Hide();
}
public
void
SetOpacity(
double
opacity)
{
original.SetOpacity(1);
}
public
void
Show(Point location, RadRichTextBox radRichTextBox)
{
original.Show(location, radRichTextBox);
}
public
double
Width
{
get
{
return
original.Width; }
}
}
Iva
the Telerik team
Is there any example on how to customize the SelectionMiniToolbar? I have a readonly textblock and I want the SelectionMiniToolbar containing just one button with Copy Command. I've tried several approaches with no succes!
Thanks.
I have prepared you a sample project that demonstrates how to create a custom selection mini toolbar with Copy button. As we discussed earlier you should use LIB assemblies (from 8.Dec or later) in order for it to be shown when RadRichTextBox is in read-only mode (these changes will also be included in Q3 SP1 expected in a couple of weeks).
Don't hesitate to contact us if you have other questions.
All the best,Boby
the Telerik team