Would be nice to see the full code instead of snippets.
Code:
public MainWindow()
{
InitializeComponent();
}
private async void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
var item = sender as TabControl;
if (item.SelectedIndex == 1)
{
Exception exception = null;
try
{
DBCStores.InitFiles();
DBCStores.LoadTitleEditorFiles();
}
catch (Exception ex)
{
exception = ex;
}
if (exception != null)
{
await this.ShowMessageAsync("Error", exception.ToString());
this.Close();
}
//listTitles.Items.Clear();
listTitles.Items.Clear();
foreach (CharTitlesEntry t in DBCStores.CharTitles.Records)
listTitles.Items.Add(t);
}
}
private void SelectTitle_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (listTitles.SelectedIndex == -1)
return;
CharTitlesEntry t = (CharTitlesEntry)listTitles.Items[listTitles.SelectedIndex];
textbox_titleId1.Text = t.Id.ToString();
textbox_titleId2.Text = t.TitleMaskId.ToString();
textbox_titleMaleName.Text = t.NameMale;
textbox_titleFemaleName.Text = t.NameFemale;
}
That should be everything, unless you are looking for the xaml too.
As I stated before; I know what bugs it out, it just doesn't make sense that adding "listTitles.Items.Clear();" twice fixes the duplication.
Last edited: