BUG: Exception {"'System.Windows.Documents.Hyperlink' is not a Visual or Visual3D."}

8 posts, 0 answers
  1. Jaroslav Půbal
    Jaroslav Půbal avatar
    52 posts
    Member since:
    Dec 2009

    Posted 14 Oct 2011 Link to this post

    Exception : {"'System.Windows.Documents.Hyperlink' is not a Visual or Visual3D."}

    My XAML:

    <telerik:RadTreeView  ItemsSource="{Binding Doklad.polozky}">
      
      
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                    <TextBlock Grid.Column="2">
                                        <Hyperlink TextDecorations="None" 
                                                   Command="{Binding EditPolozkaCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type UserControl}}}"
                                                   CommandParameter="{Binding}">    
                                        <Image  Grid.Column="2"  Width="16" Source="/Assets/Icons/Edit.png" Cursor="Hand"/>
                                        </Hyperlink>
                                    </TextBlock>
      
                                </Grid>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
      
                    </telerik:RadTreeView>



    StackTrace:

       at MS.Internal.Media.VisualTreeUtils.AsVisual(DependencyObject element, Visual& visual, Visual3D& visual3D)
       at MS.Internal.Media.VisualTreeUtils.AsNonNullVisual(DependencyObject element, Visual& visual, Visual3D& visual3D)
       at System.Windows.Media.VisualTreeHelper.GetParent(DependencyObject reference)
       at Telerik.Windows.Controls.ParentOfTypeExtensions.GetParent(DependencyObject element) in c:\TB\117\WPF_Scrum\Release_WPF_40\Sources\Development\Core\Controls\Extensions\ParentOfTypeExtensions.cs:line 85
       at Telerik.Windows.Controls.ParentOfTypeExtensions.<GetParents>d__0.MoveNext() in c:\TB\117\WPF_Scrum\Release_WPF_40\Sources\Development\Core\Controls\Extensions\ParentOfTypeExtensions.cs:line 77
       at System.Linq.Enumerable.<OfTypeIterator>d__aa`1.MoveNext()
       at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
       at Telerik.Windows.Controls.ParentOfTypeExtensions.ParentOfType[T](DependencyObject element) in c:\TB\117\WPF_Scrum\Release_WPF_40\Sources\Development\Core\Controls\Extensions\ParentOfTypeExtensions.cs:line 21
       at Telerik.Windows.Controls.ParentOfTypeExtensions.GetParent[T](DependencyObject element) in c:\TB\117\WPF_Scrum\Release_WPF_40\Sources\Development\Core\Controls\Extensions\ParentOfTypeExtensions.cs:line 64
       at Telerik.Windows.Controls.RadTreeView.OnLostFocus(Object sender, RoutedEventArgs e) in c:\TB\117\WPF_Scrum\Release_WPF_40\Sources\Development\Controls\Navigation\TreeView\RadTreeView.cs:line 1437
       at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
       at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
       at System.Windows.UIElement.OnLostFocus(RoutedEventArgs e)
       at System.Windows.UIElement.IsFocused_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
       at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
       at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
       at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
       at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
       at System.Windows.DependencyObject.ClearValueCommon(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata)
       at System.Windows.DependencyObject.ClearValue(DependencyPropertyKey key)
       at System.Windows.Input.FocusManager.OnFocusedElementChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
       at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
       at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
       at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
       at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
       at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
       at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
       at System.Windows.Input.FocusManager.SetFocusedElement(DependencyObject element, IInputElement value)
       at System.Windows.Input.KeyboardNavigation.UpdateFocusedElement(DependencyObject focusTarget)
       at System.Windows.FrameworkContentElement.OnGotKeyboardFocus(Object sender, KeyboardFocusChangedEventArgs e)
       at System.Windows.Input.KeyboardFocusChangedEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
       at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
       at System.Windows.ContentElement.RaiseTrustedEvent(RoutedEventArgs args)
       at System.Windows.Input.InputManager.ProcessStagingArea()
       at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
       at System.Windows.Input.KeyboardDevice.ChangeFocus(DependencyObject focus, Int32 timestamp)
       at System.Windows.Input.KeyboardDevice.TryChangeFocus(DependencyObject newFocus, IKeyboardInputProvider keyboardInputProvider, Boolean askOld, Boolean askNew, Boolean forceToNullIfFailed)
       at System.Windows.Input.KeyboardDevice.Focus(DependencyObject focus, Boolean askOld, Boolean askNew, Boolean forceToNullIfFailed)
       at System.Windows.Input.KeyboardDevice.Focus(IInputElement element)
       at System.Windows.ContentElement.Focus()
       at System.Windows.Documents.Hyperlink.OnMouseLeftButtonDown(Object sender, MouseButtonEventArgs e)
       at System.Windows.Documents.Hyperlink.OnMouseLeftButtonDown(MouseButtonEventArgs e)
       at System.Windows.UIElement.OnMouseLeftButtonDownThunk(Object sender, MouseButtonEventArgs e)
       at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
       at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
       at System.Windows.UIElement.OnMouseDownThunk(Object sender, MouseButtonEventArgs e)
       at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
       at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
       at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
       at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
       at System.Windows.Input.InputManager.ProcessStagingArea()
       at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
       at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
       at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
       at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 14 Oct 2011 Link to this post

    Hi Jaroslav Půbal,

     According to the code you are using RadTreeView not RadTreeListView and indeed you cannot use System.Windows.Documents.Hyperlink in this case. I strongly suggest you to visit this MSDN article for more info:
    http://msdn.microsoft.com/en-us/library/system.windows.documents.hyperlink.aspx

    All the best,
    Vlad
    the Telerik team

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

  3. UI for WPF is Visual Studio 2017 Ready
  4. Jaroslav Půbal
    Jaroslav Půbal avatar
    52 posts
    Member since:
    Dec 2009

    Posted 14 Oct 2011 Link to this post

    I read http://msdn.microsoft.com/en-us/library/system.windows.documents.hyperlink.aspx
    and nothing about use Hyperlink in DataTemplate or use Hyperlink with Command.

    I think it is problem in RadTreeView since in other components this datatemplate is working.
  5. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 14 Oct 2011 Link to this post

    Hello Jaroslav Půbal,

    Can you please test your solution with the latest internal build and let us know if you still experience this issue?

    Thank you in advance.

    Kind regards,
    Tina Stancheva
    the Telerik team

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

  6. Cody
    Cody avatar
    6 posts
    Member since:
    Nov 2011

    Posted 14 Nov 2011 Link to this post

    I'm running into the same issue. It seems to occur when a RadTreeView loses focus to a Hyperlink (System.Windows.Documents.Hyperlink)
  7. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 16 Nov 2011 Link to this post

    Hello Cody,

     We had such exception (which is really rare) in old versions of our RadTabControl andRadOutlooBar ( the RadOutlookBar inherits from RadTabControl).  Do you use these controls in your sample and what is your dlls version ? If this has nothing do with your scenario, could you please try to set Focusable = false in all System.Windows.Controls.Hyperlinks in your project ? 

    Best wishes,
    Petar Mladenov
    the Telerik team

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

  8. Cody
    Cody avatar
    6 posts
    Member since:
    Nov 2011

    Posted 16 Nov 2011 Link to this post

    Hi, Petar,
    The Hyperlink object is within a RadTabControl. I'm using version 2011.2.0920.35.
  9. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 21 Nov 2011 Link to this post

    Hi Cody,

    The first official build to provide a fix for this issue is the Q3 2011. You can also try the latest internal build 1107 from your account page at www.telerik.com. Please let us know if this solves your issues.

    Best wishes,
    Petar Mladenov
    the Telerik team

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

Back to Top
UI for WPF is Visual Studio 2017 Ready