I am currently trying to create a scene in WPF, where I have about 250 controls on the screen, and the user can move and zoom and resize these controls with the mouse.
I launched the WPF Performance Suite tools in the application when there are a large number of these controls on the screen (i.e. when the user zoomed out a little) the FPS drops to about 15, which is not very good.
Here is the main XAML outline:
<Window>
<Window.Resources>
<ControlTemplate x:Key="LandTemplate" TargetType="{x:Type local:LandControl}">
<Canvas>
<Path Fill="White" Stretch="Fill" Stroke="Black" StrokeThickness="1" Width="55.5" Height="74.687" Data="M0.5,0.5 L55,0.5 L55,74.187 L0.5,74.187 z"/>
<Canvas x:Name="DetailLevelCanvas" Width="24.5" Height="21" Canvas.Left="15.306" Canvas.Top="23.972">
<TextBlock Width="21" Height="14" Text="712" TextWrapping="Wrap" Foreground="Black"/>
<TextBlock Width="17.5" Height="7" Canvas.Left="7" Canvas.Top="14" Text="614m2" TextWrapping="Wrap" FontSize="5.333" Foreground="Black"/>
</Canvas>
</Canvas>
</ControlTemplate>
</Window.Resources>
...
<local:LandControl Width="55.5" Height="74.552" Canvas.Top="xxx" Template=" {StaticResource LandTemplate}" RenderTransformOrigin="0.5,0.5" Canvas.Left="xxx">
<local:LandControl Width="55.5" Height="74.552" Canvas.Top="xxx" Template=" {StaticResource LandTemplate}" RenderTransformOrigin="0.5,0.5" Canvas.Left="xxx">
<local:LandControl Width="55.5" Height="74.552" Canvas.Top="xxx" Template=" {StaticResource LandTemplate}" RenderTransformOrigin="0.5,0.5" Canvas.Left="xxx">
<local:LandControl Width="55.5" Height="74.552" Canvas.Top="xxx" Template=" {StaticResource LandTemplate}" RenderTransformOrigin="0.5,0.5" Canvas.Left="xxx">
... and so on...
</Window>
Ive tried to minimize the details in the control template, and I even did a massive find and replace the controls to just add my original elements to the string instead of using the template, but without noticeable performance improvements.
SO- , , , , , , .
- , !