InvalidOperationException: 'System.Windows.Documents.Hyperlink' is not a Visual or Visual3D

Docking/MDI for WPF Forum

Posted 2 years ago by Jim Foye
Version: 16.1.0634
Environment: Windows 7 (64-bit)
Avatar

I updated an app that has been working for years to16.1.634.0, and I have a weird problem now. I know the MDI library was completely revamped, and I am wondering if this is maybe a bug that was introduced, and if so, has it subsequently been fixed.

 

I have a navigation panel that is taken from one of the Actipro examples. It's basically a column of hyperlinks inside of an ExplorerBar. Commands are bound to a view model. When I click on a hyperlink now, this exception gets thrown. It happens even before control goes to my command, so I can't even debug.

System.InvalidOperationException: 'System.Windows.Documents.Hyperlink' is not a Visual or Visual3D.
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.Visual.IsAncestorOf(DependencyObject descendant)
at ActiproSoftware.Windows.Controls.Docking.Primitives.DockingWindowContainerBase.AttachToOwnedPopup(Object focusedElement)
at ActiproSoftware.Windows.Controls.Docking.Primitives.DockingWindowContainerBase.OnIsKeyboardFocusWithinChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.FocusWithinProperty.FireNotifications(UIElement uie, ContentElement ce, UIElement3D uie3D, Boolean oldValue)
at System.Windows.ReverseInheritProperty.FirePropertyChangeInAncestry(DependencyObject element, Boolean oldValue, DeferredElementTreeState treeState, Action'2 originChangedAction)
at System.Windows.ReverseInheritProperty.FirePropertyChangeInAncestry(DependencyObject element, Boolean oldValue, DeferredElementTreeState treeState, Action'2 originChangedAction)
at System.Windows.ReverseInheritProperty.FirePropertyChangeInAncestry(DependencyObject element, Boolean oldValue, DeferredElementTreeState treeState, Action'2 originChangedAction)
at System.Windows.ReverseInheritProperty.FirePropertyChangeInAncestry(DependencyObject element, Boolean oldValue, DeferredElementTreeState treeState, Action'2 originChangedAction)
at System.Windows.ReverseInheritProperty.FirePropertyChangeInAncestry(DependencyObject element, Boolean oldValue, DeferredElementTreeState treeState, Action'2 originChangedAction)
at System.Windows.ReverseInheritProperty.FirePropertyChangeInAncestry(DependencyObject element, Boolean oldValue, DeferredElementTreeState treeState, Action'2 originChangedAction)
at System.Windows.ReverseInheritProperty.FirePropertyChangeInAncestry(DependencyObject element, Boolean oldValue, DeferredElementTreeState treeState, Action'2 originChangedAction)
at System.Windows.ReverseInheritProperty.FirePropertyChangeInAncestry(DependencyObject element, Boolean oldValue, DeferredElementTreeState treeState, Action'2 originChangedAction)
at System.Windows.ReverseInheritProperty.FirePropertyChangeInAncestry(DependencyObject element, Boolean oldValue, DeferredElementTreeState treeState, Action'2 originChangedAction)
at System.Windows.ReverseInheritProperty.FirePropertyChangeInAncestry(DependencyObject element, Boolean oldValue, DeferredElementTreeState treeState, Action'2 originChangedAction)
at System.Windows.ReverseInheritProperty.FirePropertyChangeInAncestry(DependencyObject element, Boolean oldValue, DeferredElementTreeState treeState, Action'2 originChangedAction)
at System.Windows.ReverseInheritProperty.FirePropertyChangeInAncestry(DependencyObject element, Boolean oldValue, DeferredElementTreeState treeState, Action'2 originChangedAction)
at System.Windows.ReverseInheritProperty.FirePropertyChangeInAncestry(DependencyObject element, Boolean oldValue, DeferredElementTreeState treeState, Action'2 originChangedAction)
at System.Windows.ReverseInheritProperty.FirePropertyChangeInAncestry(DependencyObject element, Boolean oldValue, DeferredElementTreeState treeState, Action'2 originChangedAction)
at System.Windows.ReverseInheritProperty.FirePropertyChangeInAncestry(DependencyObject element, Boolean oldValue, DeferredElementTreeState treeState, Action'2 originChangedAction)
at System.Windows.ReverseInheritProperty.FirePropertyChangeInAncestry(DependencyObject element, Boolean oldValue, DeferredElementTreeState treeState, Action'2 originChangedAction)
at System.Windows.ReverseInheritProperty.FirePropertyChangeInAncestry(DependencyObject element, Boolean oldValue, DeferredElementTreeState treeState, Action'2 originChangedAction)
at System.Windows.ReverseInheritProperty.OnOriginValueChanged(DependencyObject oldOrigin, DependencyObject newOrigin, IList'1 otherOrigins, DeferredElementTreeState& oldTreeState, Action'2 originChangedAction)
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.ContentElement.RaiseTrustedEvent(RoutedEventArgs args)
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 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

Comments (3)

Posted 2 years ago by Jim Foye
Avatar

Here's the markup, in case you need it.

 

<UserControl x:Class="Chevron.Pde.Presentation.Views.ExplorerView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:navigation="http://schemas.actiprosoftware.com/winfx/xaml/navigation"
xmlns:shared="http://schemas.actiprosoftware.com/winfx/xaml/shared"
xmlns:themes="clr-namespace:ActiproSoftware.Windows.Themes;assembly=ActiproSoftware.Shared.Wpf"
d:DesignHeight="730"
mc:Ignorable="d">

<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="../Resources/Converters.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>

<!--
I want the hyperlink in the last row to share the same background as the expander, so I
set the grid's background with the same brush, and the expander's background to null.
-->
<Grid Background="{DynamicResource ResourceKey={x:Static themes:AssetResourceKeys.WorkspaceDarkBackgroundNormalBrushKey}}">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200" />
</Grid.ColumnDefinitions>

<navigation:ExplorerBar Background="{x:Null}">
<shared:AnimatedExpander IsExpanded="True" Style="{DynamicResource {x:Static navigation:ExplorerBar.ExpanderAlternateStyleKey}}" Visibility="{Binding Path=IsProjectOpen, Converter={StaticResource ResourceKey=booleanToVisibilityConverter}}">
<shared:AnimatedExpander.Header>
<StackPanel Margin="-10,-5,-5,-5" Orientation="Horizontal">
<Image Width="32" Height="32" Source="../Resources/Images/Explorer/Project.ico" />
<TextBlock VerticalAlignment="Center" FontWeight="Bold" Text="Project" />
</StackPanel>
</shared:AnimatedExpander.Header>

<Grid>
<Image HorizontalAlignment="Right"
VerticalAlignment="Bottom"
Opacity="0.2"
Source="../Resources/Images/Explorer/Document.png"
Stretch="None" />

<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<StackPanel Grid.Column="1" Margin="7,0,0,0" Orientation="Horizontal">
<Image Width="24" Height="24" Margin="0,0,3,0" Source="../Resources/Images/Explorer/General.ico" />
<TextBlock VerticalAlignment="Center" TextWrapping="Wrap">
<Hyperlink Command="{Binding Path=ProjectPropertiesCommand}">General</Hyperlink>
</TextBlock>
</StackPanel>
<StackPanel Grid.Row="1" Grid.Column="1" Margin="7,0,0,0" Orientation="Horizontal">
<Image Width="24" Height="24" Margin="0,0,3,0" Source="../Resources/Images/Explorer/Units.ico" />
<TextBlock VerticalAlignment="Center" TextWrapping="Wrap">
<Hyperlink Command="{Binding Path=ProjectUnitsCommand}">Units</Hyperlink>
</TextBlock>
</StackPanel>
</Grid>
</Grid>
</shared:AnimatedExpander>

<shared:AnimatedExpander IsExpanded="True" Style="{DynamicResource {x:Static navigation:ExplorerBar.ExpanderAlternateStyleKey}}" Visibility="{Binding Path=DiVisible, Converter={StaticResource ResourceKey=booleanToVisibilityConverter}}">
<shared:AnimatedExpander.Header>
<StackPanel Margin="-10,-5,-5,-5" Orientation="Horizontal">
<Image Width="32" Height="32" Source="../Resources/Images/Explorer/DI.ico" />
<TextBlock VerticalAlignment="Center" FontWeight="Bold" Text="DI" />
</StackPanel>
</shared:AnimatedExpander.Header>

<Grid>
<Image HorizontalAlignment="Right"
VerticalAlignment="Bottom"
Opacity="0.2"
Source="../Resources/Images/Explorer/Document.png"
Stretch="None" />

<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<StackPanel Grid.Column="1" Margin="7,0,0,0" Orientation="Horizontal">
<Image Width="24" Height="24" Margin="0,0,3,0" Source="../Resources/Images/Explorer/General.ico" />
<TextBlock VerticalAlignment="Center" TextWrapping="Wrap">
<Hyperlink Command="{Binding Path=DiPropertiesCommand}">Well Profile</Hyperlink>
</TextBlock>
</StackPanel>
<StackPanel Grid.Row="1" Grid.Column="1" Margin="7,0,0,0" Orientation="Horizontal">
<Image Width="24" Height="24" Margin="0,0,3,0" Source="../Resources/Images/Explorer/Grid.ico" />
<TextBlock VerticalAlignment="Center" TextWrapping="Wrap">
<Hyperlink Command="{Binding Path=BitRunsCommand}">Bit Runs</Hyperlink>
</TextBlock>
</StackPanel>
<StackPanel Grid.Row="2" Grid.Column="1" Margin="7,0,0,0" Orientation="Horizontal">
<Image Width="24" Height="24" Margin="0,0,3,0" Source="../Resources/Images/Explorer/Parameters.ico" />
<TextBlock VerticalAlignment="Center" TextWrapping="Wrap">
<Hyperlink Command="{Binding Path=DiParametersCommand}">Parameters</Hyperlink>
</TextBlock>
</StackPanel>
<StackPanel Grid.Row="3" Grid.Column="1" Margin="7,0,0,0" Orientation="Horizontal">
<Image Width="24" Height="24" Margin="0,0,3,0" Source="../Resources/Images/Explorer/Constants.ico" />
<TextBlock VerticalAlignment="Center" TextWrapping="Wrap">
<Hyperlink Command="{Binding Path=DiConstantsCommand}">Constants</Hyperlink>
</TextBlock>
</StackPanel>
<StackPanel Grid.Row="4" Grid.Column="1" Margin="7,0,0,0" Orientation="Horizontal">
<Image Width="24" Height="24" Margin="0,0,3,0" Source="../Resources/Images/Explorer/Results.ico" />
<TextBlock VerticalAlignment="Center" TextWrapping="Wrap">
<Hyperlink Command="{Binding Path=DiResultsCommand}">Results</Hyperlink>
</TextBlock>
</StackPanel>
</Grid>
</Grid>
</shared:AnimatedExpander>

<shared:AnimatedExpander IsExpanded="True" Style="{DynamicResource {x:Static navigation:ExplorerBar.ExpanderAlternateStyleKey}}" Visibility="{Binding Path=FiVisible, Converter={StaticResource ResourceKey=booleanToVisibilityConverter}}">
<shared:AnimatedExpander.Header>
<StackPanel Margin="-10,-5,-5,-5" Orientation="Horizontal">
<Image Width="32" Height="32" Source="../Resources/Images/Explorer/FI.ico" />
<TextBlock VerticalAlignment="Center" FontWeight="Bold" Text="FI" />
</StackPanel>
<!-- <shared:ImageTextInfo ImageSourceLarge="../Resources/Images/FI.ico" Text="FI" /> -->
</shared:AnimatedExpander.Header>

<Grid>
<Image HorizontalAlignment="Right"
VerticalAlignment="Bottom"
Opacity="0.2"
Source="../Resources/Images/Explorer/Document.png"
Stretch="None" />

<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<StackPanel Grid.Column="1" Margin="7,0,0,0" Orientation="Horizontal">
<Image Width="24" Height="24" Margin="0,0,3,0" Source="../Resources/Images/Explorer/General.ico" />
<TextBlock VerticalAlignment="Center" TextWrapping="Wrap">
<Hyperlink Command="{Binding Path=FiPropertiesCommand}">Application Type</Hyperlink>
</TextBlock>
</StackPanel>
<StackPanel Grid.Row="1" Grid.Column="1" Margin="7,0,0,0" Orientation="Horizontal">
<Image Width="24" Height="24" Margin="0,0,3,0" Source="../Resources/Images/Explorer/Grid.ico" />
<TextBlock VerticalAlignment="Center" TextWrapping="Wrap">
<Hyperlink Command="{Binding Path=WellsCommand}">Wells</Hyperlink>
</TextBlock>
</StackPanel>
<StackPanel Grid.Row="2" Grid.Column="1" Margin="7,0,0,0" Orientation="Horizontal" Visibility="{Binding Path=FiAnalysisVisible, Converter={StaticResource ResourceKey=booleanToVisibilityConverter}}">
<Image Width="24" Height="24" Margin="0,0,3,0" Source="../Resources/Images/Explorer/Grid.ico" />
<TextBlock VerticalAlignment="Center" TextWrapping="Wrap">
<Hyperlink Command="{Binding Path=AnalysisCommand}">Analysis</Hyperlink>
</TextBlock>
</StackPanel>
<StackPanel Grid.Row="3" Grid.Column="1" Margin="7,0,0,0" Orientation="Horizontal">
<Image Width="24" Height="24" Margin="0,0,3,0" Source="../Resources/Images/Explorer/Results.ico" />
<TextBlock VerticalAlignment="Center" TextWrapping="Wrap">
<Hyperlink Command="{Binding Path=FiResultsCommand}">Results</Hyperlink>
</TextBlock>
</StackPanel>
</Grid>
</Grid>
</shared:AnimatedExpander>

<shared:AnimatedExpander IsExpanded="True" Style="{DynamicResource {x:Static navigation:ExplorerBar.ExpanderAlternateStyleKey}}" Visibility="{Binding Path=PdeVisible, Converter={StaticResource ResourceKey=booleanToVisibilityConverter}}">
<shared:AnimatedExpander.Header>
<StackPanel Margin="-10,-5,-5,-5" Orientation="Horizontal">
<Image Width="32" Height="32" Source="../Resources/Images/Explorer/PDE.ico" />
<TextBlock VerticalAlignment="Center" FontWeight="Bold" Text="PDE" />
</StackPanel>
<!-- <shared:ImageTextInfo ImageSourceLarge="../Resources/Images/Pde.ico" Text="Pde" /> -->
</shared:AnimatedExpander.Header>

<Grid>
<Image HorizontalAlignment="Right"
VerticalAlignment="Bottom"
Opacity="0.2"
Source="../Resources/Images/Explorer/Document.png"
Stretch="None" />

<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<StackPanel Grid.Column="1" Margin="7,0,0,0" Orientation="Horizontal">
<Image Width="24" Height="24" Margin="0,0,3,0" Source="../Resources/Images/Explorer/Inputs.ico" />
<TextBlock VerticalAlignment="Center" TextWrapping="Wrap">
<Hyperlink Command="{Binding Path=PdeInputsCommand}">Inputs</Hyperlink>
</TextBlock>
</StackPanel>
<StackPanel Grid.Row="1" Grid.Column="1" Margin="7,0,0,0" Orientation="Horizontal">
<Image Width="24" Height="24" Margin="0,0,3,0" Source="../Resources/Images/Explorer/Results.ico" />
<TextBlock VerticalAlignment="Center" TextWrapping="Wrap">
<Hyperlink Command="{Binding Path=PdeResultsCommand}">Results</Hyperlink>
</TextBlock>
</StackPanel>
</Grid>
</Grid>
</shared:AnimatedExpander>

</navigation:ExplorerBar>

<TextBlock Grid.Row="1" Padding="10" TextAlignment="Center" Visibility="{Binding Path=IsProjectOpen, Converter={StaticResource ResourceKey=booleanToVisibilityConverter}}">
<Hyperlink Name="openAll" Command="{Binding Path=OpenAllCommand}">Open All</Hyperlink>
</TextBlock>

</Grid>
</UserControl>

Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Jim,

I believe build 635 fixed that bug.  Could you grab the latest maintenance release and try again?


Actipro Software Support

Posted 2 years ago by Jim Foye
Avatar

I installed 636 and that fixes it, thanks.

Jim

The latest build of this product (v2018.1 build 0675) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.