void OnListBoxItemUnselected(object sender, RoutedEventArgs e) { // When the user brings a new ListBoxItem to the front of the 3D scene // it becomes the selected item in the ListBox. At that time, we must // verify that the previously selected item's front side is facing forward. DependencyObject depObj = e.OriginalSource as DependencyObject; while (depObj != null) { if (VisualTreeHelper.GetChildrenCount(depObj) == 0) { break; } depObj = VisualTreeHelper.GetChild(depObj, 0); ContentControl3D cc3D = depObj as ContentControl3D; if (cc3D != null) { cc3D.BringFrontSideIntoView(); break; } } }