I have a user control that is essentially a listbox.
The listbox is bound to a list of objects.
I am using an ItemTemplateSelector to control how each item is displayed.
In one template I am using a Hyperlink.
My problem is as follows:
Whenever I click the hyperlink the listbox's items collection seems to be emptied out.
I can still see the listbox items but if I query myListBox.Items.Count I always get 0.
List<CallListItem> items = new List<CallListItem> {
new CallListItem { AccountNumber = "456", EPOS = false },
new CallListItem { AccountNumber = "789", EPOS = false }
};
// callListBox1 is the user control
// lstCalls is the name of the listbox in callListBox1
callListBox1.lstCalls.ItemsSource = items;
Edit: I've attached a sample application showing the behaviour inquestion. You'll need VS 2008 to open it
Last edited by dlarkin77; June 30th, 2008 at 09:11 AM.
Try setting the NavigateUri property of your Hyperlink. I ran into this same issue. As soon as I populated this property the object being passed to the event stopped being null.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.