信息框MapControl WPF(非Silverlight)

kr98yfug  于 2022-12-05  发布在  其他
关注(0)|答案(1)|浏览(246)

当您使用“Bing Maps Windows Presentation Foundation (WPF) Control, Version 1.0“按下图钉时,是否可以显示浮动的“信息框”?
我可以创建图钉,并且可以检测它们何时被单击,但我不知道如何显示浮动窗口。听起来我可以使用信息框,但我没有这个......这是否仅在Silverlight中可用?
它正在使用Visual Studio 2010进行WPF应用程序。

wdebmtf2

wdebmtf21#

您可以使用“画布与缩略图”:

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

相关问题