This is a migrated thread and some comments may be shown as answers.

SelectionMiniToolBar

11 Answers 211 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Daní
Top achievements
Rank 1
Daní asked on 26 Nov 2010, 11:52 AM
Hi,

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

Sort by
0
Iva Toteva
Telerik team
answered on 26 Nov 2010, 01:26 PM
Hello DanĂ­,

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
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Daní
Top achievements
Rank 1
answered on 26 Nov 2010, 02:14 PM
Hi Iva

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"
  
    <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

0
Iva Toteva
Telerik team
answered on 29 Nov 2010, 08:45 AM
Hi DanĂ­,

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,

Iva
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Daní
Top achievements
Rank 1
answered on 29 Nov 2010, 11:14 AM
It has an extrange behavior.

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.
0
Accepted
Boby
Telerik team
answered on 30 Nov 2010, 04:49 PM
Hi DanĂ­,

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
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Daní
Top achievements
Rank 1
answered on 09 Dec 2010, 10:57 AM
Hi Boby,

Do you know if the LIB with the updates to make visible SelectionMiniToolbar when RichTextBox is in ReadOnlyMode is already available?

thanks.
0
Boby
Telerik team
answered on 09 Dec 2010, 01:11 PM
Hi DanĂ­,
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
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Daní
Top achievements
Rank 1
answered on 09 Dec 2010, 04:20 PM
Thanks Boby,

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.
0
Iva Toteva
Telerik team
answered on 11 Dec 2010, 09:12 AM
Hi DanĂ­,

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; }
    }
}

Regards,
Iva
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Daní
Top achievements
Rank 1
answered on 05 Jan 2011, 01:22 PM
Hi,

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.
0
Boby
Telerik team
answered on 07 Jan 2011, 11:29 AM
Hello DanĂ­,
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
Browse the videos here>> to help you get started with RadControls for Silverlight
Tags
RichTextBox
Asked by
Daní
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
Daní
Top achievements
Rank 1
Boby
Telerik team
Share this question
or