private void CreateInfoWindow() { Map map = MapApplication.Current.Map; _infoWindow = new InfoWindow() { Map = map, Content = this }; Panel parentPanel = FindAncestorOfType <Panel>(map); if (parentPanel != null) { parentPanel.Children.Add(_infoWindow); } #region Info Window has to have the same Grid/Canvas positioning as the Map in order to work properly if (parentPanel is Grid) { _infoWindow.SetValue(Grid.RowProperty, map.GetValue(Grid.RowProperty)); _infoWindow.SetValue(Grid.ColumnProperty, map.GetValue(Grid.ColumnProperty)); _infoWindow.SetValue(Grid.RowSpanProperty, map.GetValue(Grid.RowSpanProperty)); _infoWindow.SetValue(Grid.ColumnSpanProperty, map.GetValue(Grid.ColumnSpanProperty)); } else if (parentPanel is Canvas) { _infoWindow.SetValue(Canvas.LeftProperty, map.GetValue(Canvas.LeftProperty)); _infoWindow.SetValue(Canvas.TopProperty, map.GetValue(Canvas.TopProperty)); } #endregion }