private void SetBinding() { Binding PositonBind = new Binding(); PositonBind.Source = this; PositonBind.Path = new PropertyPath("PositionNum"); LocalInfoList.SetBinding(ListView.SelectedIndexProperty, PositonBind); Binding PositionTextBind = new Binding(); PositionTextBind.Source = LocalInfoList; PositionTextBind.Path = new PropertyPath("SelectedIndex"); PositionTextBind.Converter = new OrderConverter(); PositionText.SetBinding(TextBlock.TextProperty, PositionTextBind); }
private void BackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { try { if (isFindArtist) { SaveLyric(); } if (!cancelProcess) { PositionNum++; LocalInfoList.ScrollIntoView(LocalInfoList.SelectedItem); backgroundWorker.RunWorkerAsync(); processNum = 100; } } catch (IOException ex) { MessageBox.Show("保存歌词时出现问题:" + ex.Message); } //else cancelProcess = false; }