object lastItem = null; foreach (object item in listView.ItemsSource) lastItem = item; if (lastItem != null) listView.Sele