Another Day Another BUG!

2 posts, 0 answers
  1. Rashad Rivera
    Rashad Rivera avatar
    63 posts
    Member since:
    Aug 2009

    Posted 09 May 2012 Link to this post

    Well yet again, I pull down the latest WPF build and find my past troubles resolved, but new ones prevail. 

    OK, down to the point.  The RadGridView is buggie due to a check in the RadWatermarkTextBox.  I don't know why, but when I override a columns template and specify TextBlock elements that use Hyperlink(s), this function fails because it assumes all focusedElements are of type Visual (which Hyperlink(s) are not).  In case your wondering why im so critical here, it is because I'm constantly finding bugs.  Go figure!

    Telerik's Code
    private bool GetIsFocused()
        var focusedElement = FocusManagerHelper.GetFocusedElement(this);
        if (focusedElement != null) {
            return focusedElement == this || this.IsAncestorOf((DependencyObject)focusedElement);
        return false;

    My improvement:
    private bool GetIsFocused()
        var focusedElement = FocusManagerHelper.GetFocusedElement(this);
        if (focusedElement != null && focusedElement is DependencyObject) {
            var focusedAsDependencyObject = (DependencyObject)focusedElement;
            if (focusedAsDependencyObject is System.Windows.Media.Visual)
                return focusedAsDependencyObject == this || this.IsAncestorOf(focusedAsDependencyObject);
            else if (focusedAsDependencyObject is FrameworkContentElement) {
                var parentVisual = ((FrameworkContentElement)focusedAsDependencyObject).Parent as System.Windows.Media.Visual;
                return focusedAsDependencyObject == this || (parentVisual != null && this.IsAncestorOf(parentVisual));
        return false;
  2. Yana
    Yana avatar
    4547 posts

    Posted 14 May 2012 Link to this post

    Hello Rashad,

    Thank you for sending your improvement.

    We are aware of this issue and we will consider it.  As a workaround, you can also set Focusable property of the Hyperlink to "False".

    Hope this helps.

    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft R3 2016 release webinar banner
Back to Top