-
Notifications
You must be signed in to change notification settings - Fork 661
Description
Describe the bug
.NET 8.0 WPF Windows Application
Add a CartesianChart to a non-current TabItem of the TabControl. After the application starts, switch to the page where the CartesianChart is located and you will notice that the control is displayed abnormally (the font becomes larger and the display is blurry). When you switch back to another TabItem, the application will crash and throw the following exception:
System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=LiveChartsCore.SkiaSharpView.WPF
StackTrace:
在 LiveChartsCore.SkiaSharpView.WPF.Rendering.CompositionTargetTicker.OnCompositonTargetRendering(Object sender, EventArgs e)
在 System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
在 System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
在 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
在 System.Windows.Threading.DispatcherOperation.InvokeImpl()
在 MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
<Window x:Class="WpfLiveChartsDemo.MainWindow"
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:lvc="clr-namespace:LiveChartsCore.SkiaSharpView.WPF;assembly=LiveChartsCore.SkiaSharpView.WPF"
xmlns:local="clr-namespace:WpfLiveChartsDemo"
mc:Ignorable="d"
Title="MainWindow" Height="420" Width="620" Loaded="Window_Loaded">
<Grid>
<TabControl x:Name="tabControl" Margin="20,20,20,20">
<TabItem Header="TabItem1">
<Grid >
<lvc:CartesianChart>
</lvc:CartesianChart>
</Grid>
</TabItem>
<TabItem Header="TabItem2">
<Grid>
<lvc:CartesianChart>
</lvc:CartesianChart>
</Grid>
</TabItem>
</TabControl>
</Grid>
</Window>To Reproduce
Steps to reproduce the behavior:
- Click on 'TabItem2'
- Click on 'TabItem1'
- See error
Screenshots
LiveCharts Version
- LiveChartsCore.SkiaSharpView.WPF 2.0.0-rc6.1
Desktop
- OS: Windows 11
- Version: 25H2