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

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

7 Answers 559 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Jaroslav Půbal
Top achievements
Rank 1
Jaroslav Půbal asked on 14 Oct 2011, 01:57 PM
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)

7 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 14 Oct 2011, 02:00 PM
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 >>

0
Jaroslav Půbal
Top achievements
Rank 1
answered on 14 Oct 2011, 02:14 PM
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.
0
Tina Stancheva
Telerik team
answered on 14 Oct 2011, 04:10 PM
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 >>

0
Cody
Top achievements
Rank 1
answered on 15 Nov 2011, 03:43 AM
I'm running into the same issue. It seems to occur when a RadTreeView loses focus to a Hyperlink (System.Windows.Documents.Hyperlink)
0
Petar Mladenov
Telerik team
answered on 16 Nov 2011, 06:51 PM
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 >>

0
Cody
Top achievements
Rank 1
answered on 16 Nov 2011, 11:31 PM
Hi, Petar,
The Hyperlink object is within a RadTabControl. I'm using version 2011.2.0920.35.
0
Petar Mladenov
Telerik team
answered on 21 Nov 2011, 05:44 PM
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 >>

Tags
TreeListView
Asked by
Jaroslav Půbal
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Jaroslav Půbal
Top achievements
Rank 1
Tina Stancheva
Telerik team
Cody
Top achievements
Rank 1
Petar Mladenov
Telerik team
Share this question
or