static void AddSelectionEvent(ListBox list) { list.SelectionChanged += delegate { MessageBox.Show(""); }; }