c# - WPF set visibility of item in listbox - code behind -


i have listbox (added in code behind) , want set visibility of last item when items.count > 4. have list box full of buttons.

private void movingofbuttons(listbox list, int index)     {         control previousbutton = (control)list.items.getitemat(list.items.count - 1);         int itemcounts = ktery.items.count;          indexbutton = index;         // create new buttons         addnewbutton("sound");         addnewbutton("addsound");         maincycle(list);          // not work - show messagebox         if (itemcounts >= 4)         {             messagebox.show("" + previousbutton.name);             previousbutton.visibility = visibility.collapsed;         }          (list).items.removeat(index);     } 

this previousbutton.visibility not work.

where error?

i found error:

i have "refresh" items in listbox.. ;)

maincycle(list);  previousbutton = (control)list.items.getitemat(list.items.count - 1);          if (itemcounts >= 4)         {             messagebox.show("" + previousbutton.name);             previousbutton.visibility = visibility.collapsed;         } 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -