Last active
December 16, 2015 09:28
-
-
Save ericsk/5412895 to your computer and use it in GitHub Desktop.
加入 OnSelectionChanged 的事件處理函式
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ... | |
| private void OnSelectionChanged(object sender, SelectionChangedEventArgs e) | |
| { | |
| ListView source = (ListView)sender; | |
| // 如果要將選取的 focus 移開,改變 SelectedIndex 就可以 | |
| // 但就要處理被移開後不再重新呼叫 OnSelectionChanged | |
| if (source.SelectedIndex != -1) | |
| { | |
| // 取得選取的資料項目 | |
| MessageModel message = (MessageModel)source.SelectedItem; | |
| // 需要時移開註解使用 | |
| // source.SelectedIndex = -1; | |
| } | |
| } | |
| ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment