Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8751731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:06:16+00:00 2026-06-13T13:06:16+00:00

I have problems with a .NET 4 application using Bing Maps with custom pushpins.

  • 0

I have problems with a .NET 4 application using Bing Maps with custom pushpins. The performance is very bad on zooming or moving the map. I’m using a ObservableCollection which has a data-binding to Bing Maps. Everytime the map changes it is being checked which pushpins are in the map section. The collection will be re-filled and finally a NotifyCollectionChangedEvent is being fired which makes the map draw the pushpins.

<bingMap:MapItemsControl ItemsSource="{Binding Locations}">
    <bingMap:MapItemsControl.ItemTemplate>
        <DataTemplate>
            <bingMap:Pushpin Location="{Binding Coordinates}" Height="Auto" Width="Auto" PositionOrigin="BottomCenter"
                Template="{StaticResource PushpinControlTemplateLoc}">
            </bingMap:Pushpin>
        </DataTemplate>
    </bingMap:MapItemsControl.ItemTemplate>
</bingMap:MapItemsControl >

I made some researches with a performance profiler: The InitializeComponent() method of my custom pushpin class needs an average time of 25% to 35%!

There are usually between 10 and 25 custom pushpins displayed on the map. If I reduce the amount of data bindings it becomes a little bit faster, but still not fast enough.

I’ve already tested out to declare all the brushes as freezed static resources but the drawing still runs very slow.

<SolidColorBrush x:Key="SolidColorBrushUnknownMsg" Color="Gray" ice:Freeze="True"  xmlns:ice="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options" />

I tried to use the Microsoft default pushpins <bingMap:Pushpin Location="{Binding Coordinates}"/> which was much faster. So there must be something wrong in my usage or implementation of my custom pushpin.

Here’s the rest of my code:

Custom pushpin class (only auto-generated code):

public partial class MyPushpin: System.Windows.Controls.Grid
{
    public MyPushpin()
    {
        InitializeComponent();
    }
}

Custom pushpin XAML code:

<Grid x:Class="Test.MyPushpin"
    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">

    <Grid.Resources>
        <Style BasedOn="{StaticResource DataTextBlock}" x:Key="test1" TargetType="TextBlock">
            <Setter Property="Background" Value="{StaticResource SolidColorBrushErrorMsg}"/>
        <Style.Triggers>
            <DataTrigger Binding="{Binding Path=TextLine1, Mode=OneWay}" Value="0">
                <Setter Property="Background" Value="{StaticResource BackgroundImage}"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>
</Grid.Resources>

<Border CornerRadius="20" BorderBrush="White" Padding="7" Opacity="0.8" Width="120" Height="100" Background="{StaticResource BackgroundImage}">
    <Grid >
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>

        <TextBlock Grid.Row="0" Grid.Column="0" Text="test2"  Foreground="Black" />
        <TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding TextLine2, StringFormat=N1,Mode=OneWay}" Style="{StaticResource DataTextBlock}" />
        <TextBlock Grid.Row="0" Grid.Column="2" Text="{Binding objCurrentPower.sUnit,Mode=OneWay}"  Foreground="Black" />

        <!--three more lines of textblocks with data bindings -->

    </Grid>
</Border>

Why does my custom pushpin need so much performance?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T13:06:16+00:00Added an answer on June 13, 2026 at 1:06 pm

    Problem solved: Instead of using a separate class and xaml and referencing to them it’s better to use a ControlTemplate for the custom pushpins in the class the actually contains the Bing Map:

    <ControlTemplate x:Key="CutomPushpinTemplate" TargetType="bingMap:Pushpin">
        <Border CornerRadius="15" BorderBrush="White" Padding="7" Opacity="0.8" Width="120" Height="90" Background="{StaticResource Bgr_enercon}">
            <Grid >
                <Grid.RowDefinitions>
                    <RowDefinition Height="16" />
                    <RowDefinition Height="16" />
                    <RowDefinition Height="16" />
                    <RowDefinition Height="16" />
                    <RowDefinition Height="16" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="45" />
                    <ColumnDefinition Width="32" />
                    <ColumnDefinition Width="23" />
                </Grid.ColumnDefinitions>
    
                <TextBlock Grid.Row="0" Grid.Column="0" Text="test2"  Foreground="Black" />
                <TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding TextLine2, StringFormat=N1,Mode=OneWay}" Style="{StaticResource DataTextBlock}" />
                <TextBlock Grid.Row="0" Grid.Column="2" Text="{Binding objCurrentPower.sUnit,Mode=OneWay}"  Foreground="Black" />
    
                <!--three more lines of textblocks with data bindings -->
    
            </Grid>
        </Border>
    </ControlTemplate>
    

    This template is used for all pushpins of the Bing Map this way:

    <bingMap:MapItemsControl ItemsSource="{Binding Locations}">
        <bingMap:MapItemsControl.ItemTemplate>
            <DataTemplate>
                <bingMap:Pushpin Location="{Binding objCoordinates}" Height="Auto" Width="Auto" PositionOrigin="BottomCenter" Template="{StaticResource CutomPushpinTemplate}">
                </bingMap:Pushpin>
            </DataTemplate>
        </bingMap:MapItemsControl.ItemTemplate>
    

    Doing it that way is much faster. The performance profiler shows that the programm now does not spend so much time for instantiating the custom pushpins.

    Here is the xaml code which shows how it was implemented before (slow):

    <ControlTemplate x:Key="PushpinControlTemplateLoc" TargetType="bingMap:Pushpin" >
        <Test.MyPushpin />
    </ControlTemplate>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a small application using Microsoft .NET. I don't have problems with
Here's the core problem: I have a .NET application that is using COM interop
I have a problem with a memory leak in a very large ASP.NET application.
I have the next very strange situation and problem: .NET 4.0 application for diagram
We have an ASMX web service which we invoke from our ASP.NET application using
I have built an application using Visual Studio .NET and it works fine. After
I have an ASP.NET MVC 3 application using an Entity Framework (4.3.1) Code First
I have no problems using AForge classes in a Windows Form application in Visual
We have a web application written in ASP.NET for .NET 3.5, using standard web
I have problems with the performance of the UI of my WPF application on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.