public AddEditLayer(Mode mode) { InitializeComponent(); WindowStartupLocation = WindowStartupLocation.CenterScreen; CurrentMode = mode; ApplyButton.Content = (CurrentMode == Mode.Create) ? "Create layer" : "Edit layer"; this.Title = (CurrentMode == Mode.Create) ? "Creating layer" : "Editing layer"; if (CurrentMode == Mode.Edit) { OriginalName = MainWindow.Instance.TileLayerComboBox.SelectedItem.ToString(); LayerName.Text = OriginalName; LayerName.Focus(); LayerName.SelectAll(); PositionLabel.IsEnabled = false; LayerIndexes.IsEnabled = false; } foreach (string layerAlias in Global.Layers) { LayerIndexes.Items.Add(layerAlias); } LayerIndexes.SelectedIndex = MainWindow.Instance.TileLayerComboBox.SelectedIndex; LayerName.Focus(); }