Justei
Topic Author
Posts: 17
Joined: 28 Aug 2013, 21:03

Removing ListBox item.

23 Sep 2013, 18:08

Hey there! Fast question I figured more people would run into sooner or later anyway.

I have a listbox that I populate with code.
And then when I want to remove one of the items, I'm unsure on how to go about that!

Here's the code I'm using right now, and it doesn't seem to remove the item. In fact it does absolutely nothing (in terms of removing, everything else is just fine).

ListBoxItem itemToDelete = _characterList.GetSelectedItem().As<ListBoxItem>();

        // Do some magic stuff here, unimportant. But it Does use the button and actually verifies that the button reference is correct.

       // Nothing happens when I call Dispose. Wrong function?
        _characterList.GetSelectedItem().Dispose();


 
User avatar
sfernandez
Site Admin
Posts: 1973
Joined: 22 Dec 2011, 19:20

Re: Removing ListBox item.

23 Sep 2013, 19:18

_characterList.GetItems().Remove(_characterList.GetSelectedItem());
Is that what you are looking for?

Who is online

Users browsing this forum: No registered users and 1 guest