//Add map name to list private void AddMapButton_Click(object sender, RoutedEventArgs e) { if (_maps.Contains(MapsBox.Text)) { return; } _maps.Add(MapsBox.Text); MapList.Items.Refresh(); MapList.SelectedIndex = MapList.Items.Count - 1; MapList.ScrollIntoView(MapList.SelectedItem); }
private void MoveDownButton_Click(object sender, RoutedEventArgs e) { int index = MapList.SelectedIndex; if (index == -1 || index == _maps.Count - 1) { return; } string tmp = _maps[index + 1]; _maps[index + 1] = _maps[index]; _maps[index] = tmp; MapList.Items.Refresh(); MapList.SelectedIndex = index + 1; MapList.ScrollIntoView(MapList.SelectedItem); }