SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components

Answered
1
0

In the designer I’m seeing this. It doesn’t seem to affect the application; however, I can’t see any of my XAML in the designer because of this problem. Also, I’m having a strange intermittent issue with multiple instances of the chart in my UI not being as smooth and sharp after adding a few charts.

DllNotFoundException: Unable to load DLL ‘sharpdx_direct3d11_1_effects_x86.dll’: The specified module could not be found. (Exception from HRESULT: 0x8007007E)

at SciChart.Drawing.DirectX.Context.D3D11.DirectXHelper.LTC.J(Object D, DXErrorEventArgs I)
at SciChart.Drawing.DirectX.Context.D3D11.Direct3D11RenderSurface.RecreateSurface()
at SciChart.Drawing.Common.RenderSurfaceBase.RenderSurfaceSizeChanged(Object sender, SizeChangedEventArgs sizeChangedEventArgs)
at System.Windows.SizeChangedEventArgs.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.RaiseEvent(RoutedEventArgs e)
at System.Windows.FrameworkElement.OnRenderSizeChanged(SizeChangedInfo sizeInfo)
at System.Windows.ContextLayoutManager.fireSizeChangedEvents()
at System.Windows.ContextLayoutManager.UpdateLayout()
at System.Windows.UIElement.UpdateLayout()

Here’s the XAML for my chart

        <!-- Chart  -->
    <s:SciChartSurface Grid.Row="1" Grid.Column="1"                                   
                       Name="DoseChart"
                       s3d:DirectXHelper.TryApplyDirectXRenderer="True"
                       s3d:DirectXHelper.FallbackType="{x:Type s:HighQualityRenderSurface}"
                       RenderableSeries="{s:SeriesBinding Measurements}"
                       Annotations="{s:AnnotationsBinding Annotations}"
                       Style="{StaticResource ResourceKey=SurfaceStyle}"                                                      
                       GridLinesPanelStyle="{StaticResource ResourceKey=GridLinesPanelStyle}">


        <!-- Distance Axis-->
        <s:SciChartSurface.XAxis>
            <s:NumericAxis AxisTitle="Distance (cm)"
                           FontFamily="Arial" FontSize="12"
                               FlipCoordinates="False"
                               GrowBy="0.05, 0.05"
                               ScientificNotation="None" 
                               s:CursorModifier.AxisLabelContainerStyle="{StaticResource CursorModAxisLabelStyle}"
                               s:CursorModifier.AxisLabelTemplate="{StaticResource CursorModAxisLabelTemplate}"
                               Style="{DynamicResource ResourceKey=DistanceAxisStyle}" />
        </s:SciChartSurface.XAxis>

        <!-- Dose Axis -->
        <s:SciChartSurface.YAxis>
            <s:NumericAxis AxisTitle="Dose (%)"
                           FontFamily="Arial"
                               GrowBy="0.05, 0.05" 
                               Style="{DynamicResource ResourceKey=DoseAxisStyle}"
                               s:CursorModifier.AxisLabelContainerStyle="{StaticResource CursorModAxisLabelStyle}"
                               s:CursorModifier.AxisLabelTemplate="{StaticResource CursorModAxisLabelTemplate}" />
        </s:SciChartSurface.YAxis>

        <!-- Modifiers (zoom, panning, tooltips, cursor) -->
        <s:SciChartSurface.ChartModifier>
            <s:ModifierGroup>
                <s:RubberBandXyZoomModifier IsAnimated="True" IsXAxisOnly="False" />
                <s:ZoomExtentsModifier ExecuteOn="MouseDoubleClick" />
                <s:ZoomPanModifier ExecuteOn="MouseRightButton" />
                <s:MouseWheelZoomModifier ActionType="Zoom" XyDirection="XYDirection" />
                <s:XAxisDragModifier DragMode="Scale" />
                <s:YAxisDragModifier DragMode="Scale" />
                <s:TooltipModifier x:Name="ChartTooltip" IsEnabled="True" />
                <s:CursorModifier x:Name="ChartCursor" IsEnabled="False" ShowAxisLabels="True" Foreground="Red" />
            </s:ModifierGroup>
        </s:SciChartSurface.ChartModifier>

    </s:SciChartSurface>
Version
5.2.2.11833
  • You must to post comments
Best Answer
2
0

Published workaround.

We are not sure why the DLL file sharpdx_direct3d11_1_effects_x86.dll is not pickled up by the Visual Studio designer, no matter what we try we cannot get it to work either. So we have this workaround.

Please enable DirectX only when NOT in the designer, like so:

    <s:SciChartSurface >
        <s:SciChartSurface.Style>
            <Style TargetType="{x:Type s:SciChartSurface}">
                <Style.Triggers>
                    <!-- Enable DirectX only when not in designer -->
                    <Trigger Property="componentModel:DesignerProperties.IsInDesignMode" Value="False">
                        <Setter Property="s3D:DirectXHelper.TryApplyDirectXRenderer" Value="True" />
                        <Setter Property="s3D:DirectXHelper.FallbackType" Value="{x:Type s:HighQualityRenderSurface}" />
                    </Trigger>
                </Style.Triggers>
            </Style>
        </s:SciChartSurface.Style>
        <s:SciChartSurface.XAxis>
            <s:NumericAxis/>
        </s:SciChartSurface.XAxis>
        <s:SciChartSurface.YAxis>
            <s:NumericAxis/>
        </s:SciChartSurface.YAxis>
    </s:SciChartSurface>

Best regards,
Andrew

  • Chris Kirkman
    Your solution presents me with another problem. First, my style is defined as an application resource, which should be fine, but my App.xaml doesn’t recognize the ‘componentModel:DesignerProperties.IsInDesignMode’ property. Next I decided to try to remove that problem from the equation by adding the style directly to the chart as you’ve provided here in your example. I still have the same problem. :( I get “DesignerProperties is not supported in a Windows Presentation Foundation (WPF) project”, and “The namespace prefix ‘componentModel’ is not defined”. Any ideas?
  • Andrew
    Chris, it’s in the stackoverflow post I referenced. https://stackoverflow.com/a/32874861/303612 xmlns:componentModel=”clr-namespace:System.ComponentModel;assembly=PresentationFramework”
  • Chris Kirkman
    okay, it looks like this works as long as you remove the 2 lines that were directly entered in the SciChart declaration in XAML. In other words, the TryApplyDirectXRenderer and FallBackType must be declared in the surface style and excluded specifically in the chart header in XAML for the chart itself.
  • Andrew
    Aha right – yes its either / or. Best regards, Andrew
  • You must to post comments
0
0

OK so silly question but have you included sharpdx_direct3d11_1_effects_x86.dll in your application with ‘Copy to output directory = Always’ as per our instructions here?

When including SharpDX from NuGet there is no need to include these libraries as they are automatically copied to output when the application is run.

However, if the designer fails to pick them up then it could be a problem with SharpDX or the Visual Studio Designer process itself. In which case we’d recommend simply including the libraries sharpdx_direct3d11_1_effects_x86.dll and sharpdx_direct3d11_1_effects_x64.dll manually in your project with ‘Copy to output = Always’

Update – Disable DirectX in design mode

This problem could also be resolved by only applying DirectX when not in design mode. Please see this StackOverflow question for how.

<Style TargetType="{x:Type s:SciChartSurface}">
    <Style.Triggers>
        <Trigger Property="ComponentModel:DesignerProperties.IsInDesignMode"
                 Value="False">
            <!-- Only apply TryApplyDirectXRenderer=true when Not in designer -->
            <Setter Property="s3D:DirectXHelper.TryApplyDirectXRenderer" Value="True" />
        </Trigger>
    </Style.Triggers>
</Style>

Best regards,
Andrew

  • Chris Kirkman
    Andrew. Yes, I’m using the NuGet package method to add references. And it does run fine and display the chart at runtime. It’s only at design time that I have this issue. Before adding the DirectX version of the SciChart the designer worked as well. This is only after adding the DirectX version that this happens. I have followed the method to add directly to my project (as per the video above) and have the same result.
  • Andrew
    I had another thought. Only enable DirectX when not at design time. How to do this: https://stackoverflow.com/a/32874861/303612
  • Andrew
    If the libraries are included and copy-to-output, then its a visual studio designer issue, we can’t help. But the above method to include only when not design time will help.
  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.