【问题标题】:InfoBox MapControl WPF (Not Silverlight)InfoBox MapControl WPF(不是 Silverlight)
【发布时间】:2012-07-25 18:36:03
【问题描述】:

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

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

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

Visual Studio 2010.WPF 应用程序

谢谢

【问题讨论】:

    标签: wpf bing-maps


    【解决方案1】:

    您可以使用画布和拇指:

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

    【讨论】:

    • 谢谢。我不知道 WPF 在设计方面实际上是如何工作的,所以一旦我了解了在哪里放置标记,我会告诉你的。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-27
    • 1970-01-01
    • 2012-04-13
    • 1970-01-01
    相关资源
    最近更新 更多