public void populateUnmoddedBars() { //TODO examine if this is really how I want to do this. //It probably isn't. This method reeks of pretending to be useful in more than one case. foreach (UIElement child in unModeratedStack.Children) { (child as ItemBar).RemovePressed -= thisBar_RemovePressed; (child as ItemBar).ContentPressed -= thisBar_ContentPressed; } unModeratedStack.Children.Clear(); ItemBar thisBar; foreach (Post post in unmoderatedLinks) { thisBar = new ItemBar(); thisBar.populate(post); thisBar.RemovePressed += thisBar_RemovePressed; thisBar.ContentPressed += thisBar_ContentPressed; thisBar.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; unModeratedStack.Children.Add(thisBar); } }