SelectionChanged不起作用

时间:2014-06-23 09:08:01

标签: c# winforms listbox

我尝试了很多周才意识到Selection Changed,但我无法做到这一点,因为SelectedIndex总是-1。请帮帮我。 源代码:

private void MondayListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
    if (MondayListBox.SelectedIndex == -1)
        MessageBox.Show("nain!!"+ MondayListBox.SelectedIndex.ToString()+"");
        //return;

        // Navigate to the new page
        NavigationService.Navigate(new Uri("/data.xaml?selectedItem=" + MondayListBox.SelectedIndex, UriKind.Relative));

        // Reset selected index to -1 (no selection)
        MondayListBox.SelectedIndex = -1;
}

0 个答案:

没有答案