private void Map_MouseMove(object sender, MouseEventArgs e)
        {
            PointShape mouseLocation = ExtentHelper.ToWorldCoordinate(map.CurrentExtent, new ScreenPointF(e.X, e.Y), map.Width, map.Height);

            lblLocationX.Text = string.Format(CultureInfo.InvariantCulture, "X:{0:N6}", mouseLocation.X);
            lblLocationY.Text = string.Format(CultureInfo.InvariantCulture, "Y:{0:N6}", mouseLocation.Y);
            stpFooter.Refresh();

            if (!currentFeatureLayer.IsOpen)
            {
                return;
            }
            HighlightOverlay USDemographicOverlay = (HighlightOverlay)map.Overlays["HighlightOverlayKey"];

            USDemographicOverlay.UpdateHighlightFeature(currentFeatureLayer, mouseLocation);

            // Here we get tootip for the highlighted feature.
            bool mapNeedsUpdate = USDemographicOverlay.HighlightFeature != null &&
                                  (PreviousHighlightFeature == null || (PreviousHighlightFeature != null && PreviousHighlightFeature.Id != USDemographicOverlay.HighlightFeature.Id));

            if (mapNeedsUpdate)
            {
                toolTip1.Hide(map);
                toolTip1.Dispose();

                string resultText = string.Empty;
                foreach (string item in currentStyleBuilder.SelectedColumns)
                {
                    string columnName = TextFormatter.GetFormatedString(item, double.Parse(USDemographicOverlay.HighlightFeature.ColumnValues[item]));
                    resultText = string.Format("{0}{1}\n", resultText, columnName);
                }

                toolTip1 = new ToolTip();
                toolTip1.InitialDelay = 1000;
                toolTip1.SetToolTip(map, resultText);
                map.Refresh(USDemographicOverlay);
            }
            else if (USDemographicOverlay.HighlightFeature == null)
            {
                toolTip1.Hide(map);
                toolTip1.Dispose();
            }

            PreviousHighlightFeature = USDemographicOverlay.HighlightFeature;
        }
        public StackPanel GetToolTip(Feature feature)
        {
            StackPanel popupPanel = new StackPanel();

            popupPanel.Margin = new Thickness(5);

            if (mapModel.DefaultFeatureLayer == mapModel.CensusStateFeatureLayer)
            {
                TextBlock stateName = new TextBlock();
                stateName.FontWeight = FontWeights.Bold;
                stateName.FontFamily = new FontFamily("Segoe UI");
                stateName.Text       = feature.ColumnValues["NAME"];
                stateName.FontSize   = 14;
                stateName.Margin     = new Thickness(0, 0, 0, 10);

                popupPanel.Children.Add(stateName);
                popupPanel.Children.Add(new Separator()
                {
                    Margin = new Thickness(0, 0, 0, 10)
                });
            }

            foreach (var column in CurrentStyleBuilder.SelectedColumns)
            {
                if (feature.ColumnValues.ContainsKey(column))
                {
                    TextBlock columnText = new TextBlock();
                    columnText.FontFamily = new FontFamily("Segoe UI");
                    columnText.Text       = TextFormatter.GetFormatedString(column, double.Parse(feature.ColumnValues[column]));
                    columnText.FontSize   = 12;
                    columnText.Margin     = new Thickness(0, 0, 0, 3);

                    popupPanel.Children.Add(columnText);
                }
            }
            return(popupPanel);
        }