void edit_button_Click(object sender, RoutedEventArgs e) { int index = this.ids.SelectedIndex; if (index >= 0) { int i = 0; foreach (string key in Model.Instance.ActiveMap.Values.Keys) { if (i == index) { EditKeyWindow ekw = new EditKeyWindow(Model.Instance.ActiveMap.Values[key]); if (ekw.ShowDialog() ?? false) { Model.Instance.ActiveMap.Values[key] = ekw.FinalValue; this.RefreshListing(); } break; } ++i; } } }