wpfbing-maps

InfoBox MapControl WPF (not Silverlight)


Is it possible to show a floating "infobox" when you press a push pin using "Bing Maps Windows Presentation Foundation (WPF) Control, Version 1.0"?

I can create push pins and I can detect when they are clicked, but I don’t have any idea how to show a floating window. It sounds like I can use a InfoBox, but I don't have this...is this only available in Silverlight?

It is using Visual Studio 2010 for a WPF application.


Solution

  • You can use Canvas & Thumb:

    <Window
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:maps="clr-namespace:Microsoft.Maps.MapControl.WPF;assembly=Microsoft.Maps.MapControl.WPF" 
            x:Class="WpfApplication15.MainWindow">
        <Grid>
            <maps:Map/>
            <Canvas>
                <Grid Name="grid"
                      Canvas.Left="0" Canvas.Top="0"
                      Width="200" Height="100">
                    <!-- Your control begin -->
                    <Rectangle Fill="Blue"/>
                    <!-- Your control end -->
                    <Thumb Name="thumbMove">
                        <Thumb.Template>
                            <ControlTemplate>
                                <Rectangle Fill="Transparent"/>
                            </ControlTemplate>
                        </Thumb.Template>
                    </Thumb>
                </Grid>
            </Canvas>
        </Grid>
    </Window>
    
    thumbMove.DragDelta += (s, e) =>
    {
        Canvas.SetLeft(grid, Canvas.GetLeft(grid) + e.HorizontalChange);
        Canvas.SetTop(grid, Canvas.GetTop(grid) + e.VerticalChange);
    };