0

我的 wpf 应用程序中有这个 GridView 定义,我也在使用 ComponentArt

<my1:GridView Name="gridView1" Theme="ArcticWhite" Indent="40" RowClicked="gridView1_RowClicked_1" AllowColumnFreezing="False" AllowRowFreezing="False" ColumnResizingMode="Normal" AllowColumnReordering="False" AutoGenerateColumns="False" IsHitTestVisible="True" ThemeVariant="Standard" Foreground="#FFDBDBCD">
    <my1:GridView.Columns>
        <my1:GridViewTemplateColumn Binding="{Binding}"  Header="Local">
            <my1:GridViewTemplateColumn.CellTemplate>
                <DataTemplate>
                    <Grid Margin="-7,-3,-2,-3" Name="grid1">
                        <Grid.Background>
                            <MultiBinding Converter="{StaticResource BackgroundBrushConverter}">
                                <Binding ElementName="r1" Path="Fill"></Binding>
                                <Binding ElementName="cbColores" Path="IsChecked"></Binding>
                            </MultiBinding>
                        </Grid.Background>
                        <Rectangle Name="r1" Fill="{Binding Converter={StaticResource BrushConverter}}" Width="1" Height="1"></Rectangle>
                        <TextBlock Margin="3" Foreground="Black" Text="{Binding Local}" FontFamily="Calibri" FontWeight="Bold" FontSize="13">
                    <TextBlock.Effect>
                        <DropShadowEffect Color="White" BlurRadius="3" ShadowDepth="0" Opacity="5" />
                    </TextBlock.Effect>
                        </TextBlock>
                    </Grid>
                </DataTemplate>
            </my1:GridViewTemplateColumn.CellTemplate>
        </my1:GridViewTemplateColumn>
        <my1:GridViewTemplateColumn Binding="{Binding}"  Header="Linea">
            <my1:GridViewTemplateColumn.CellTemplate>
                <DataTemplate>
                    <Grid  Margin="-7,-3,-2,-3" Name="grid2">
                        <Grid.Background>
                            <MultiBinding Converter="{StaticResource BackgroundBrushConverter}">
                                <Binding ElementName="r2" Path="Fill"></Binding>
                                <Binding ElementName="cbColores" Path="IsChecked"></Binding>
                            </MultiBinding>
                        </Grid.Background>
                        <Rectangle Name="r2" Fill="{Binding Converter={StaticResource BrushConverter}}" Width="1" Height="1"></Rectangle>
                        <TextBlock Margin="3" Foreground="Black" Text="{Binding Linea}"  FontFamily="Calibri" FontWeight="Bold" FontSize="13">
                    <TextBlock.Effect>
                        <DropShadowEffect Color="White" BlurRadius="3" ShadowDepth="0" Opacity="5" />
                    </TextBlock.Effect>
                        </TextBlock>
                    </Grid>
                </DataTemplate>
            </my1:GridViewTemplateColumn.CellTemplate>
        </my1:GridViewTemplateColumn>
    </my1:GridView.Columns>
</my1:GridView>

当我打开应用程序时,cpu 增加到 50-60%,没有做任何事情;并保持这个速度,直到我关闭应用程序

我可以做些什么来提高性能吗?

提前致谢

4

1 回答 1

0

您可以尝试DropShadowEffect从单元格模板中删除 s - 特别是如果您在此网格中有很多单元格并且未启用虚拟化。据我了解,您应该尽量避免同时使用DropShadowEffectBlurEffect处理大量目标。

于 2012-08-09T16:13:04.007 回答