How to change the cursor's color?

21 posts, 0 answers
  1. Chen
    Chen avatar
    12 posts
    Member since:
    Jul 2010

    Posted 07 Nov 2010 Link to this post

    Hello,

    When the text's highlight is Black, I can't find the cursor, because the cursor's color is black, how to change it?

    Thanks.
    Chen
  2. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 11 Nov 2010 Link to this post

    Hello Chen,

    We do not provide API for customizing the look of the caret.
    Thank you for pointing out this use-case, where the caret must not be black. We will make sure to change that behavior in the future.

    Sincerely yours,
    Iva
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Toby Riley
    Toby Riley avatar
    40 posts
    Member since:
    Aug 2012

    Posted 08 Apr 2011 Link to this post

    Hi,

    Any update on this one?

    I would like to change the caret colour.

    Thanks T.
  5. Mike
    Admin
    Mike avatar
    640 posts

    Posted 11 Apr 2011 Link to this post

    Hi Tobias Riley,

    You can add the following Style to RadRichTextBox resources in order to change the caret color:
    <telerik:RadRichTextBox.Resources>
        <Style TargetType="telerikUI:Caret">
            <Setter Property="CaretBrush" Value="White" />
        </Style>
    </telerik:RadRichTextBox.Resources>

    Let us know if this worked for you.

    Kind regards,
    Mike
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. Toby Riley
    Toby Riley avatar
    40 posts
    Member since:
    Aug 2012

    Posted 12 Apr 2011 Link to this post

    Thanks,

    Strangely it works 50% of the time.

    I have the richtextbox in tha childwindow, on popup/show the cursor flashes white but then loses focus to another control. On return to focus it sometimes keeps it's white color or reverts back to black.

    What can I do about this?

    Thanks.
  7. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 15 Apr 2011 Link to this post

    Hello Tobias Riley,

    We were not able to reproduce the issue. Could you please open a support ticket and send a sample application that illustrates the problem and some steps (if necessary) that would lead to the behavior you describe?

    All the best,
    Iva
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  8. Toby Riley
    Toby Riley avatar
    40 posts
    Member since:
    Aug 2012

    Posted 05 May 2011 Link to this post

    Hi,

    I'm really stuggling to recreate this in a test app! typical.

    Any ideas as where to start with this....any holes that you could think are causing this problem?
  9. Boby
    Admin
    Boby avatar
    595 posts

    Posted 11 May 2011 Link to this post

    Hi Tobias Riley,

    The Caret actually inherits from TextBox, so at first place you should check if you set any implicit styles to text boxes in your application.
    How do you set the style of the caret - implicit or explicit? Do you perform any additional manipulations to the focus - for example calls to Focus method of some of the controls?

    Best wishes,
    Boby
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  10. Toby Riley
    Toby Riley avatar
    40 posts
    Member since:
    Aug 2012

    Posted 11 May 2011 Link to this post

    Hi,

    I'm setting like like below within a custom theme.

    I have this within a childwindow and on the open event I call focus on another control, I did remove this as I noticed that the RadRichTextBox seems to open with focus and then it flicks to this other control but then on return to the RadRichTextBox it sometimes doesn't keep it's white CaretBrush. Even after removal it still occurred so I didn't explore this much further.

    Any help is really appreciated.

        <Style TargetType="telerikUI:Caret">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="telerikUI:Caret" >
                        <Grid x:Name="RootElement"  >
                            <ScrollViewer 
                                x:Name="ContentElement"
                                BorderThickness="0" Padding="0" />
                            <Rectangle x:Name="Rectangle" />
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="HorizontalAlignment" Value="Left" />
            <Setter Property="VerticalAlignment" Value="Top" />
            <Setter Property="AcceptsReturn" Value="True" />
            <Setter  Property="CaretBrush" Value="White"/>
            <Setter Property="Padding" Value="0" />
            <Setter Property="Foreground" Value="Transparent" />
        </Style>

  11. Boby
    Admin
    Boby avatar
    595 posts

    Posted 13 May 2011 Link to this post

    Hi Tobias Riley,

    We managed to reproduce the issue and it looks like this is a problem in the ChildWindow, as Microsoft's TextBox has similar behavior. I'm attaching a simple demo that illustrates the case - on second or third showing of the ChildWindow both TextBox and RadRichTextBox carets
    As a workaround you could add the Caret style directly in the RadRichTextBox resources (or anywhere in the ChildWindow):

    <telerik:RadRichTextBox Name="radRichTextBox" Background="Black">
        <telerik:RadRichTextBox.Resources>
            <Style TargetType="telerikUI:Caret">
                <Setter Property="CaretBrush" Value="White" />
            </Style>
        </telerik:RadRichTextBox.Resources>
    </telerik:RadRichTextBox>

    Don't hesitate to contact us if you have other questions.


    Kind regards,
    Boby
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  12. Toby Riley
    Toby Riley avatar
    40 posts
    Member since:
    Aug 2012

    Posted 13 May 2011 Link to this post

    Hi Boby,

    Thanks for looking into this but I'm still loosing the color, even with the fix below.

    Any other suggestions?

    Thanks Toby.
  13. Boby
    Admin
    Boby avatar
    595 posts

    Posted 18 May 2011 Link to this post

    Hello Tobias Riley,

    It would be really hard to continue investigating the issue without a way to reproduce it; so the best thing you can do is to isolate the problem and send us a sample application (attaching it in a support ticket) that can reproduce it. The very first thing I would check would be if the ChildWindow is involved – try to remove it and see if the problem persists.

    Kind regards,
    Boby
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  14. Chandra Prakash
    Chandra Prakash avatar
    4 posts
    Member since:
    Mar 2011

    Posted 20 Jun 2011 Link to this post

    Hi Boby,

    I am using RadRichTextBox and there is a problem that Focus not set in text area and cursor is not blinking. However I write text in text area the cursor should be blinking, But anyhow its not working. Any idea that you could think this type of behavior?

    Regards
    Prakash Gupta
    Web Designer
    INDIA
  15. Vesko
    Admin
    Vesko avatar
    45 posts

    Posted 22 Jun 2011 Link to this post

    Hi Chandra Prakash,

    Thanks for your question!
    To be able to understand properly what the problem might be, we will need to have a small demo application demonstrating it. Please open a support ticket and send us an example application which isolate the problem.

    Best wishes,
    Vesko
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  16. Rakesh Gandhi
    Rakesh Gandhi avatar
    14 posts
    Member since:
    Apr 2010

    Posted 18 Jul 2011 Link to this post

    Hi,

    I am using RadRichTextBox control, I have added telerik.windows.controls.input dll to the reference of this control. but I am facing below exception error.
    anyone have any idea?

    Exception Message : Object reference not set to an instance of an object.

     Stack Trace :    at Telerik.Windows.Documents.DocumentPositionLocationHelper.GetLineY(InlineLayoutBox box)
       at Telerik.Windows.Documents.DocumentPositionLocationHelper.GetCenter(InlineLayoutBox layoutBox)
       at Telerik.Windows.Documents.DocumentPositionLocationHelper.IsBetterSolution(InlineLayoutBox currentSolution, InlineLayoutBox candidateSolution, PointF position)
       at Telerik.Windows.Documents.DocumentPositionLocationHelper.GetNearestLeafBoxByPosition(PointF position, LayoutBox root, LayoutBox& currentSolution)
       at Telerik.Windows.Documents.DocumentPositionLocationHelper.GetLayoutBoxByPosition(PointF position, LayoutBox root)
       at Telerik.Windows.Documents.DocumentPosition.SetPosition(PointF position, Boolean MoveToNextIfOutOfBox)
       at Telerik.Windows.Documents.Selection.MouseSelectionHandler.SetDocumentPosition(DocumentPosition documentPosition, Point position, Boolean moveToNextIfOutOfBox)
       at Telerik.Windows.Documents.Selection.MouseSelectionHandler.RegisterDocumentSingleMouseDown(Boolean ctrlPressed, Boolean shiftPressed, Point position)
       at Telerik.Windows.Documents.Selection.MouseSelectionHandler.RegisterDocumentMouseDown(Boolean ctrlPressed, Boolean shiftPressed, Point position)
       at Telerik.Windows.Documents.UI.DocumentPresenterBase.Owner_MouseLeftButtonDown(Object sender, MouseButtonEventArgs e)
       at MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
       at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)

    Thanks,
    - Parth Gandhi
    Samyak Infotech Pvt. Ltd.
    Ahmedabad
  17. Toby Riley
    Toby Riley avatar
    40 posts
    Member since:
    Aug 2012

    Posted 19 Jul 2011 Link to this post

    Strange that you would post this in this thread but.....I have the same/similar intermittant error.

    The stack trace is below:

    at Telerik.Windows.Documents.DocumentPositionLocationHelper.GetLineY(InlineLayoutBox box)

       at Telerik.Windows.Documents.DocumentPositionLocationHelper.GetCenter(InlineLayoutBox layoutBox)

       at Telerik.Windows.Documents.DocumentPositionLocationHelper.IsBetterSolution(InlineLayoutBox currentSolution, InlineLayoutBox candidateSolution, PointF position)

       at Telerik.Windows.Documents.DocumentPositionLocationHelper.GetNearestLeafBoxByPosition(PointF position, LayoutBox root, LayoutBox& currentSolution)

       at Telerik.Windows.Documents.DocumentPositionLocationHelper.GetNearestLeafBoxByPosition(PointF position, LayoutBox root, LayoutBox& currentSolution)

       at Telerik.Windows.Documents.DocumentPositionLocationHelper.GetLayoutBoxByPosition(PointF position, LayoutBox root)

       at Telerik.Windows.Documents.DocumentPosition.SetPosition(PointF position, Boolean MoveToNextIfOutOfBox)

       at Telerik.Windows.Documents.UI.DocumentWebLayoutPresenter.GetDocumentPositionFromViewPoint(Point viewPoint)

       at Telerik.Windows.Documents.UI.DocumentPresenterBase.Owner_MouseRightButtonUp(Object sender, MouseButtonEventArgs e)

       at MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)

       at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)


    HELP!

     
  18. Boby
    Admin
    Boby avatar
    595 posts

    Posted 21 Jul 2011 Link to this post

    Hi Rakesh and Tobias,
    We are sorry for the inconvenience. Could you please give us more details about the way to reproduce the exception - for example some steps to follow or sample project (document)?
    Looking forward to your reply.

    Kind regards,
    Boby
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  19. Toby Riley
    Toby Riley avatar
    40 posts
    Member since:
    Aug 2012

    Posted 25 Jul 2011 Link to this post

    Sorry I cannot recreate, it seems a random issue.

    I'll post if I discover what it is.
  20. Rakesh
    Rakesh avatar
    19 posts
    Member since:
    Feb 2012

    Posted 26 Sep 2012 Link to this post

    I have similar requirement where my richtextbox background is black, I need to change cursor to white. I am using radrichtextbox in radwindow. If I use the style in richtextbox resource, it works for the first time when you open a window. If you reopen same window, you lose the foreground.

    I see similar issue with the example you provided.
    Even when user types, the foreground of text is black. Is there any way we can set foreground to white as whatever user enters.

    Is there any workaround to this problem. How can we get this functionality. Please help me. It's really very important to us.

    Thanks

    Rakesh
  21. Todor
    Admin
    Todor avatar
    168 posts

    Posted 28 Sep 2012 Link to this post

    Hi Rakesh,

    We are still not able to reproduce the issue with the care you have reported. If you like, you can open a support ticket and send us a sample project which contains the problem.

    As for your other question, in order to set the RadRichTextBox text color to white by default, you can use this line of code which sets the default color for the current document instance:
    ((RadRichTextBox)sender).Document.StyleRepository["Normal"].SpanProperties.ForeColor = Colors.White;

    You can execute it on RadRichTextBox_Loaded and on RadRichTextBox_DocumentChanged, as the StyleRepository is a property of the document.

    Hope this helps.

     

    Kind regards,
    Todor
    the Telerik team

    Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

  22. Jan
    Jan avatar
    1 posts
    Member since:
    Oct 2013

    Posted 04 Oct 2013 Link to this post

    Now easily done

    [code]<telerik:RadRichTextBox CaretColor="White">[/code]
Back to Top
DevCraft banner