private void GroupRenameClick(object sender, RoutedEventArgs e)
        {
            if (!((((sender as MenuItem)?.Parent as ContextMenu)?.PlacementTarget as FrameworkElement)?.DataContext is MallowGroup group))
            {
                return;
            }

            string result = RenameWindow.Rename(group.Name);

            if (!string.IsNullOrEmpty(result))
            {
                group.Name = result;
            }
        }
示例#2
0
        public static string Rename(string origin)
        {
            RenameWindow window = new RenameWindow
            {
                RenameTextBox =
                {
                    Text = origin
                }
            };

            window.RenameTextBox.Focus();
            window.ShowDialog();
            return(window.RenameTextBox.Text);
        }