ArcGIS API for Silverlight 点击地图上的要素,弹出窗口(使用Telerik RadWindow)

xmlns:telerikNavigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"
xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"

 <!-- 详情信息显示窗口-->
<telerikNavigation:RadWindow x:Name="RadWindow1"  Tag="详情" BorderBackground="#B4DEFE" Width="520"   Height="330"  LocationChanged="RadWindow1_LocationChanged" WindowState="Maximized">
         <telerik:RadHtmlPlaceholder x:Name="moreInfo" SourceUrl="" />
</telerikNavigation:RadWindow>

#region 处理弹出窗口公共类

        public void ClickOpenDetailInfo(string name, string url)
        {
            TextBlock textBlock = new TextBlock();
            moreInfo.Height = 541;
            moreInfo.SourceUrl = new Uri(url, UriKind.Relative);
            string tmp = string.Empty;
             tmp = name + "详细信息";
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < tmp.Length; i++)
            {
                sb.Append(tmp[i] + " ");
            }
            textBlock.Text = sb.ToString();
            textBlock.FontSize = 16;
            textBlock.FontWeight = FontWeights.Black;
            SolidColorBrush scbrush = new SolidColorBrush();
            scbrush.Color = Colors.Black;
            textBlock.Foreground = scbrush;

            textBlock.HorizontalAlignment = HorizontalAlignment.Center;
            RadWindow1.Header = textBlock;
            RadWindow1.Show();
        }


        private void RadWindow1_LocationChanged(object sender, RoutedEventArgs e)
        {
            moreInfo.InvalidateArrange();
        }


        #endregion

//左键菜单
graphic.MouseLeftButtonDown += new MouseButtonEventHandler(sw_graphic_MouseLeftButtonDown);
 graphic.MouseLeftButtonUp += new MouseButtonEventHandler(sw_graphic_MouseLeftButtonUp);

void sw_graphic_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
         e.Handled = true;
}

 void sw_graphic_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
            Graphic g = sender as Graphic;
            string url = "../ysq/page2.aspx?stype=2&ylz=" + HttpUtility.UrlEncode(g.Attributes["YLZMC"].ToString());
            //弹出窗体
            ClickOpenDetailInfo(g.Attributes["YLZMC"].ToString(), url);
}


效果如下图,这个窗口能保证每次只弹出一个。

ArcGIS API for Silverlight 点击地图上的要素,弹出窗口(使用Telerik RadWindow)

上一篇:MySQL解析器源码分析--对select语句中子查询处理逻辑的分析(一)


下一篇:用 C# 轻松读取、改变文件的创建、修改、访问时间