c# - How to select a ListBoxItem which is already selected OR to highlight previous selected ListBoxItem after setting SelectedIndex to -1? -


i'm programming simple listbox in windows phone 7. listbox has items , when click of items app navigates new page.

from beginning here, good.

but want end-user can select item again causes navigate next page again. listbox is, doesn't allow me select selected item again.

i tried allowing select item again.

private void listbox_selectionchanged(object sender, selectionchangedeventargs e) {     if(listbox.selectedindex != -1 )     {        navigationservice.navigate(uri);        listbox.selectedindex = -1;      } } 

i have alreadhy edited listboxitemtemplate highlight selected item, when use above code, cannot highlight selected item, because changes selectedindex fast.

so how can allow user select selected item or how can highlight previous selected item. suggestions or tips?

edit: when using normal listbox , can use :

listboxitem1.background = new solidcolorbrush(color.blue);` 

but when edit template of listbox item throw exception, cannot still this.

well, can edit template of listboxitem , add grid, front of listbox item. , bind visibility property of grid.

after this, can change of visibility according selected index. approach should work if you're using navigation listbox.

hope works!


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -