private void DataListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { ListBox listbox = (ListBox)sender; ListViewTemplate view = (ListViewTemplate)listbox.SelectedItem; if (view == null) { return; } if (oldview != null) { string name = GetNpcName(oldview.Data.NpcId); _listview .Where(v => v.Data.NpcId == oldview.Data.NpcId) .First() .Name = name; listbox.Items.Refresh(); } oldview = view; propertyGrid.SelectedObject = view.Data; }
private void AddButton_Click(object sender, RoutedEventArgs e) { ListViewTemplate view = new ListViewTemplate(); view.Name = "N/A"; view.Data = new SpawnTemplate(); _listview.Add(view); RefreshListBox(); }
private void DataListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { ListBox listbox = (ListBox)sender; ListViewTemplate view = (ListViewTemplate)listbox.SelectedItem; if (view == null) return; if (oldview != null) { string name = GetNpcName(oldview.Data.NpcId); _listview .Where(v => v.Data.NpcId == oldview.Data.NpcId) .First() .Name = name; listbox.Items.Refresh(); } oldview = view; propertyGrid.SelectedObject = view.Data; }