none
WPF Animations Cause Performance Issues for Excel Spell Check RRS feed

  • Question

  • Hello 

    I work at a company that develops multiple Office addins and we've recently discovered when an animation is active on a WPF control inside a task pane, the spell check window slows down. A customer brought this issue to our attention and are bothered by this slow down, because having our addin loaded is causing a slowdown to spell check. 

    How can we stop the performance impact WPF is having on Excel spell check? 

    I've constructed a test addin that demonstrates the behavior. The addin creates a task pane which is a winforms control with an ElementHost that hosts a WPF control. The WPF control has a small animation on loop. If you try and replace words using the built in spell check window when the task pane is visible, a noticeable pause will occur.

    Here's the code for the WPF control:

    <UserControl x:Class="TestWpfTaskPane.TestControl"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
                 mc:Ignorable="d" 
                 d:DesignHeight="450" d:DesignWidth="800">
        <Grid>
            <Canvas>
                <Path Fill="Blue" Margin="15,15,15,15">
                    <Path.Data>
                        <EllipseGeometry x:Name="MyAnimatedEllipseGeometry" Center="10,100" RadiusX="15" RadiusY="15" />
                    </Path.Data>
                    <Path.Triggers>
                        <EventTrigger RoutedEvent="Path.Loaded">
                            <BeginStoryboard Name="MyBeginStoryboard">
                                <Storyboard>
                                    <PointAnimationUsingPath Storyboard.TargetName="MyAnimatedEllipseGeometry" Storyboard.TargetProperty="Center" Duration="0:0:5" RepeatBehavior="Forever" >
                                        <PointAnimationUsingPath.PathGeometry>
                                            <PathGeometry Figures="M 20,10 C 30,50 10,100 20,150" />
                                        </PointAnimationUsingPath.PathGeometry>
                                    </PointAnimationUsingPath>
                                </Storyboard>
                            </BeginStoryboard>
                        </EventTrigger>
                    </Path.Triggers>
                </Path>
            </Canvas>
        </Grid>
    </UserControl>
    

    System Information:

    Windows Version: 10.0.18363

    Excel Version: 11929.20606

    Test Addin .NET Framework Version: 4.7.2

    Microsoft.Office.Interop.Excel Version: 2.0.50727

    Thanks in advance for any help,

    Matt

    Tuesday, February 25, 2020 10:05 PM