protected virtual void OnLoadingUriColumns(LoadingUriColumnsDataViewerUserControlEventArgs e)
        {
            EventHandler <LoadingUriColumnsDataViewerUserControlEventArgs> handler = LoadingUriColumns;

            if (handler != null)
            {
                handler(this, e);
            }
        }
        private void UserControl_Loaded(object sender, System.Windows.RoutedEventArgs e)
        {
            featureLayers = new Collection <FeatureLayer>(featureLayers.Where(l =>
            {
                var plugin = GisEditor.LayerManager.GetLayerPlugins(l.GetType()).FirstOrDefault() as FeatureLayerPlugin;
                return(plugin != null);
            }).ToList());
            if (isEditable)
            {
                string helpUri = GisEditor.LanguageManager.GetStringResource("EditDataHelp");
                HelpContainer.Content = HelpButtonHelper.GetHelpButton(helpUri, HelpButtonMode.IconOnly);
            }
            else
            {
                string helpUri = GisEditor.LanguageManager.GetStringResource("ViewDataHelp");
                HelpContainer.Content = HelpButtonHelper.GetHelpButton(helpUri, HelpButtonMode.IconOnly);
            }

            LoadingUriColumnsDataViewerUserControlEventArgs args = new LoadingUriColumnsDataViewerUserControlEventArgs();

            foreach (var item in linkColumnNames)
            {
                args.UriColumnNames.Add(item.Key, item.Value);
            }
            OnLoadingUriColumns(args);
            if (args.UriColumnNames.Count > 0)
            {
                foreach (var item in args.UriColumnNames)
                {
                    linkColumnNames[item.Key] = item.Value;
                }
            }

            viewModel = new DataViewerViewModel(map, featureLayers, selectedFeatureLayer, isHighlightFeatureOnly, isEditable, linkColumnNames);
            this.deleteColumn.Visibility = viewModel.EditVisible;
            this.DataContext             = viewModel;
            viewModel.EditDataChanges.CollectionChanged += EditDataChanges_CollectionChanged;

            scrollBar = GetVisualChild <ScrollBar>(dg);
            scrollBar.LostMouseCapture += new MouseEventHandler(scrollBar_LostMouseCapture);
            Window parentWindow = Parent as Window;

            ContextMenu contextMenu = new ContextMenu();

            MenuItem exportItem = new MenuItem();

            exportItem.Header = GisEditor.LanguageManager.GetStringResource("ViewDataExportButton");

            exportItem.Icon = new Image {
                Source = new BitmapImage(new Uri("/GisEditorInfrastructure;component/Images/exporttoexcel.png", UriKind.RelativeOrAbsolute)), Width = 16, Height = 16
            };
            exportItem.Click += new RoutedEventHandler(ExportItem_Click);

            MenuItem menuItem = new MenuItem()
            {
                Header = GisEditor.LanguageManager.GetStringResource("DataViewerUserControlExportSelectedData")
            };

            menuItem.Icon = new Image {
                Source = new BitmapImage(new Uri("/GisEditorInfrastructure;component/Images/exporttoexcel.png", UriKind.RelativeOrAbsolute)), Width = 16, Height = 16
            };
            menuItem.Click += new RoutedEventHandler(MenuItem_Click);

            MenuItem copyRowMenuItem = new MenuItem()
            {
                Header = GisEditor.LanguageManager.GetStringResource("DataViewerUserControlCopySelectedRowLabel")
            };

            copyRowMenuItem.Icon = new Image {
                Source = new BitmapImage(new Uri("/GisEditorInfrastructure;component/Images/copytoexcel.png", UriKind.RelativeOrAbsolute)), Width = 16, Height = 16
            };
            copyRowMenuItem.Click += new RoutedEventHandler(CopyRowMenuItem_Click);

            MenuItem copyCellMenuItem = new MenuItem()
            {
                Header = GisEditor.LanguageManager.GetStringResource("DataViewerUserControlCopySelectedCellLabel")
            };

            copyCellMenuItem.Icon = new Image {
                Source = new BitmapImage(new Uri("/GisEditorInfrastructure;component/Images/copytoexcel.png", UriKind.RelativeOrAbsolute)), Width = 16, Height = 16
            };
            copyCellMenuItem.Click += new RoutedEventHandler(CopyCellMenuItem_Click);

            contextMenu.Items.Add(exportItem);
            contextMenu.Items.Add(menuItem);
            contextMenu.Items.Add(copyRowMenuItem);
            contextMenu.Items.Add(copyCellMenuItem);
            dg.ContextMenu = contextMenu;

            if (parentWindow != null)
            {
                parentWindow.Closing += ParentWindow_Closing;
            }
        }