We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Click on Hyperlink column throws 'System.Windows.Documents.Run' is not a Visual or Visual3D'

Hi!

I have a problem in the HyperlinkColumn of a SfDataGrid, whenever I click the link the following exception it's thrown

System.InvalidOperationException
  HResult=0x80131509
  Message='System.Windows.Documents.Run' no es un Visual ni un Visual3D.
  Source=PresentationCore
  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 Syncfusion.Windows.Controls.Input.SfTextBoxExt.FindVisualParent[parentItem](DependencyObject obj)
   at Syncfusion.Windows.Controls.Input.SfTextBoxExt.MainWindow_PreviewMouseLeftButtonDown(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.OnPreviewMouseDownThunk(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)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.Run()
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run()

And this is my XAML Code

                <sf:SfDataGrid
                    Grid.Row="2"
                    Margin="10"
                    AutoGenerateColumns="False"
                    ColumnSizer="Star"
                    ItemsSource="{Binding Data.PruebasAsignadas}">
                    <sf:SfDataGrid.Columns>
                        <sf:GridTextColumn HeaderText="Nombre de la prueba" MappingName="Prueba.Servicio" />
                        <sf:GridHyperlinkColumn HeaderText="Metodologia" MappingName="Prueba.RefDocumental" />
                        <sf:GridTextColumn HeaderText="Químico asignado" MappingName="Quimico.Firma" />
                        <sf:GridCheckBoxColumn HeaderText="¿Completada?" MappingName="Completada" />
                        <sf:GridTextColumn HeaderText="Fecha de entrega" MappingName="FechaAnalisis" />
                        <sf:GridTextColumn HeaderText="Resultados" MappingName="Resultados" />
                        <sf:GridTemplateColumn HeaderText="Acciones">
                            <sf:GridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
                                        <sf:ButtonAdv
                                            sf:FocusManagerHelper.FocusedElement="True"
                                            Command="{Binding Data.ObservationsCommand, Source={StaticResource DataContextProxy}}"
                                            CommandParameter="{Binding}"
                                            Label="Observaciones" />
                                    </StackPanel>
                                </DataTemplate>
                            </sf:GridTemplateColumn.CellTemplate>
                        </sf:GridTemplateColumn>
                    </sf:SfDataGrid.Columns>


I'm using nuget package v21.1.41 previously was using the .38 and this problem was not present.

Thanks in advance!

OS: Win 11

.NET Version: 6.0

Platform: WPF


1 Reply

SJ Sathiyathanam Jeyakumar Syncfusion Team April 26, 2023 01:13 PM UTC

Hi Emilio,

We have reviewed the reported issue with the information provided, but unfortunately, we were unable to replicate the problem on our end. To further investigate, we kindly request that you provide us with the codes related to the CurrentCellRequestNavigate event that you used to navigate hyperlinks. Additionally, we noticed a reference to SfTextBoxExt.MainWindow_PreviewMouseLeftButtonDown in the callstack. Could you please share us with the codes associated with the PreviewMouseLeftButtonDown event of SfTextBoxEXT? If you use SfTextBoxEXT in your application, please share the relevant codes for that as well. It will be helpful to provide the solution as soon as possible.

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 Syncfusion.Windows.Controls.Input.SfTextBoxExt.FindVisualParent[parentItem](DependencyObject obj)
   at Syncfusion.Windows.Controls.Input.SfTextBoxExt.MainWindow_PreviewMouseLeftButtonDown(Object sender, MouseButtonEventArgs e)


CurrentCellRequestNavigate Event code:

private void dataGrid_CurrentCellRequestNavigate(object sender, CurrentCellRequestNavigateEventArgs e)

{

    string address = "https://www.syncfusion.com/";

    System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo(address);

    info.UseShellExecute = true;

    Process.Start(info);

}

Regards,

Sathiyathanam


Attachment: SfDataGridDemo_561e071b.zip

Loader.
Up arrow icon