This project is read-only.

OverHeadMap Customization

May 26, 2013 at 3:26 AM
Hi there.

I am not sure if this was asked before, but I can't seem to find it.

I successfully customized the items on the WoldView, but I can seem to find a way to change the OverheadMap view items, and all I have are some red characters...
Can someone help me please?

Thanks
Jul 2, 2013 at 4:39 PM
Edited Jul 2, 2013 at 4:49 PM
Still don't know why author hadn't provided ItemTemplate in OverheadMap.
Workaround provided by author in https://gart.codeplex.com/discussions/347237 doesn't work.
You can do it by yourself by editing source code of the project:

In GART.Controls.OverheadMap.cs:
Add those lines:
        public DataTemplate ItemTemplate {
            get {
                return (DataTemplate)GetValue(ItemTemplateProperty);
            }
            set {
                SetValue(ItemTemplateProperty, value);
            }
        }

        public static readonly DependencyProperty ItemTemplateProperty =
            DependencyProperty.Register("ItemTemplate", typeof(DataTemplate), typeof(OverheadMap), null);
In GART.Themes.Generic.xaml:
  • remove DataTemplate named "MapShape"
  • In style:
<Style TargetType="controls:OverheadMap">
find line:
<maps:MapItemsControl x:Name="ItemsLayer" ...
and replace it with:
<maps:MapItemsControl x:Name="ItemsLayer" ItemTemplate="{Binding ItemTemplate, RelativeSource={RelativeSource TemplatedParent}}" ItemsSource="{Binding}" />
Add setter to preserve default ItemTemplate:
        <Setter Property="ItemTemplate">
            <Setter.Value>
                <DataTemplate>
                    <TextBlock Text="{Binding Content}" 
                   Foreground="Red" 
                   Visibility="{Binding GeoLocation, Converter={StaticResource UnknownGeoVisibilityConverter}}"
                   maps:MapLayer.PositionOrigin="Center" 
                   maps:MapLayer.Position="{Binding GeoLocation, Converter={StaticResource UnknownGeoCoordinateConverter}}" 
                   />
                </DataTemplate>
            </Setter.Value>
        </Setter>
And that is all. Now you can use your custom DataTemplate as ItemTemplate in OverheadMap like usual.
Jul 3, 2013 at 9:12 PM
@archol, Thanks for your post. We going to expose ItemTemplate on OverheadMap using your approach very soon.