private void RenameTextBlock_TextRenamed(object sender, TextRenamedEventArgs e)
        {
            var viewModel     = DataContext as BookmarkRibbonGroupViewModel;
            var existingNames = viewModel.DisaplayBookmarks.Select(b => b.Name).ToList();

            existingNames.Remove(viewModel.SelectedBookmark.Name);
            if (BookmarkNamePromptViewModel.ValidateBookmarkName(e.NewText, existingNames))
            {
                if (!viewModel.SelectedBookmark.Name.Equals(e.NewText))
                {
                    viewModel.SelectedBookmark.Name = e.NewText;
                }
            }
            else
            {
                e.IsCancelled = true;
                System.Windows.Forms.MessageBox.Show(GisEditor.LanguageManager.GetStringResource("BookmarkListUserControlNameIllegalText"), GisEditor.LanguageManager.GetStringResource("GeneralMessageBoxInfoCaption"));
            }
        }
        public BookmarkNamePromptWindow(string bookmarkName, IEnumerable <string> existingNames)
        {
            UnitTestHelper.ApplyWindowStyle(this);
            InitializeComponent();

            HelpContainer.Content = HelpResourceHelper.GetHelpButton("BookmarksHelp", HelpButtonMode.IconOnly);
            viewModel             = new BookmarkNamePromptViewModel(bookmarkName, existingNames);
            DataContext           = viewModel;
            Messenger.Default.Register <DialogMessage>(this, viewModel, msg =>
            {
                MessageBox.Show(msg.Content, msg.Caption, msg.Button, msg.Icon);
            });
            Messenger.Default.Register <bool>(this, viewModel, msg =>
            {
                if (msg)
                {
                    DialogResult = true;
                }
            });

            Unloaded += (s, e) => Messenger.Default.Unregister(this);
        }