当前位置: 首页>>代码示例>>C#>>正文


C# Pushpin.SetBinding方法代码示例

本文整理汇总了C#中Microsoft.Phone.Controls.Maps.Pushpin.SetBinding方法的典型用法代码示例。如果您正苦于以下问题:C# Pushpin.SetBinding方法的具体用法?C# Pushpin.SetBinding怎么用?C# Pushpin.SetBinding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Phone.Controls.Maps.Pushpin的用法示例。


在下文中一共展示了Pushpin.SetBinding方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateBingMapControl

        private void CreateBingMapControl()
        {

            //// HACK need to create this control in code after onload because of a bug with the bing map control
            if (mapMain == null)
            {
                mapMain = System.Windows.Markup.XamlReader.Load(BING_MAP_XAML) as Map;

                if (mapLayer == null)
                {
                    mapLayer = mapMain.FindVisualChild("mapLayer") as MapLayer;
                    deviceLocation = mapMain.FindVisualChild("deviceLocation") as Pushpin;
                    deviceLocation.SetBinding(UIElement.VisibilityProperty, new Binding("CurrentDevicePositionVisible"));
                    deviceLocation.SetBinding(Pushpin.LocationDependencyProperty, new Binding("CurrentDevicePosition"));
                }
                else
                {
                    MapLayer temp = mapMain.FindVisualChild("mapLayer") as MapLayer;
                    mapMain.Children.Remove(temp);
                    mapMain.Children.Add(mapLayer);
                    Pushpin p = mapMain.FindVisualChild("deviceLocation") as Pushpin;
                    mapMain.Children.Remove(p);
                    mapMain.Children.Add(deviceLocation);
                }

                //start the is downloading timer
                //HACK need to shwo a progress bar when tiles are downloading as requested from MSFT
                mapMain.ViewChangeStart += ViewChangeStart_IsDownloadingProgressHandler;
                if (m_isDownloadingTimer == null)
                {
                    m_isDownloadingTimer = new DispatcherTimer();
                    m_isDownloadingTimer.Interval = new TimeSpan(0, 0, 0, 0, 100);
                    m_isDownloadingTimer.Tick += (s1, e1) =>
                    {
                        m_isDownloadingTimer.Stop();
                        if (mapMain == null)
                        {
                            //pb_mapDownloading.IsIndeterminate = false;
                            //pb_mapDownloading.Visibility = System.Windows.Visibility.Collapsed;
                            m_isDownloadingTimer.Stop();
                        }
                        else
                        {
                            if (mapMain.Mode.IsDownloading)
                            {
                                //pb_mapDownloading.IsIndeterminate = true;
                                //pb_mapDownloading.Visibility = System.Windows.Visibility.Visible;
                            }
                            else
                            {
                                //pb_mapDownloading.IsIndeterminate = false;
                                //pb_mapDownloading.Visibility = System.Windows.Visibility.Collapsed;
                                m_isDownloadingTimer.Stop();
                                return;
                            }
                        }

                        //restart the timer but change the interval to every 2 secs
                        m_isDownloadingTimer.Interval = new TimeSpan(0, 0, 2);
                        m_isDownloadingTimer.Start();
                    };
                }

                //add to the content grid
                ContentGrid.Children.Insert(0, mapMain);

                SetupMap();
            }
        }
开发者ID:FaisalNahian,项目名称:311NYC,代码行数:69,代码来源:LocatePage_BingMap.cs


注:本文中的Microsoft.Phone.Controls.Maps.Pushpin.SetBinding方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。