james.baker
james.baker

Reputation: 85

DropShadow on large object causing ScrollViewer slowdown

I am having issues with using the DropShadowEffect on a large WPF element. I know there have been issues with this effect in the past and found a few old questions but I was wanting to make sure I had some up to date information and possibly a good solution as I have struggled to find one that isn't 9+ years old.

This issue duplicates only on high resolution scenarios so when the application window is at 1080p+. It seems to be made worse by having 2 different monitors at different resolution and DPI's. My example is a 4k screen running at 250% DPI and a 1440p screen running at 125% DPI.

Here is the code:

    <Window.Resources>
        <Color po:Freeze="True" x:Key="GrayBrush" >#d3d3d3</Color>
        <DropShadowEffect x:Key="dropShadow" BlurRadius="20" ShadowDepth="0" Color="{StaticResource GrayBrush}" po:Freeze="True" />
    </Window.Resources>

    <Grid>
        <Rectangle Fill="LightBlue" Effect="{StaticResource dropShadow}" Margin="20"/>
    
        <ScrollViewer Margin="20">
            <VirtualizingStackPanel>
                <TextBox />
                etc...
            </VirtualizingStackPanel>
        </ScrollViewer>
    </Grid>

Here is a link to a sample of a rough duplication of the problem sample.

Upvotes: 0

Views: 106

Answers (1)

james.baker
james.baker

Reputation: 85

Since nobody seems to have an answer to anything being wrong with my sample. I've been forced to ditch them altogether. Seems a bit of a major flaw not to be able to trust using them. If anybody does have any more information please do let me know!

Using this instead. A little more awkward but seems to be pretty lightweight.

enter image description here

Upvotes: 0

Related Questions