InfoBox MapControl WPF(不是Silverlight)

时间:2012-07-23 17:57:40

标签: wpf bing-maps

当使用“Bing Maps Windows Presentation Foundation(WPF)Control 1.0版”按下推针时,有人可以告诉我是否可以显示浮动的“信息框”

http://www.microsoft.com/en-us/download/details.aspx?id=27165

我可以创建推针,我可以检测它们何时被点击但我不知道如何显示浮动窗口。听起来我可以使用InfoBox,但我没有这个....这只在silverlight中可用吗?

Visual Studio 2010. WPF应用程序

由于

1 个答案:

答案 0 :(得分:1)

你可以使用Canvas&拇指:

<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);
};