I have a problem with listbox. When in my program I click on one ListBoxItem, I want to change/open the window and preorder it before. But the problem is that it firstly fires the event and then it changes selection. Code:
private void LB_Playlist_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (LB_Playlist.SelectedItem != null)
{
try
{
List<string> _tempList = new List<string>();
File_Load_List(LB_Playlist.SelectedItem.ToString(), _tempList);
LoadListIntoBox(_tempList);
G_SongList.Visibility = Visibility.Visible;
AnimationMove(G_Playlist, G_Playlist.Margin, new Thickness(-264, 0, 0, 0), AnimationDuration, true);
AnimationMove(G_SongList, new Thickness(264, 0, 0, 0), new Thickness(0, 0, 0, 0), AnimationDuration, false);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
}
When I tried it with MessageBox.Show(LB_Playlist.SelectedIndex.ToString()); It was working, selection was changing but the message was showing. Is there any way to change it?