public void setViewMode(ViewModeENum viewMode) { bool opened = false; // tbtnViewNormal.IsChecked = false; tbtnViewDetailed.IsChecked = false; // switch (viewMode) { case ViewModeENum.NORMAL: opened = false; tbtnViewNormal.IsChecked = true; break; case ViewModeENum.DETAILED: opened = true; tbtnViewDetailed.IsChecked = true; break; } // foreach (UISearchResultItem itemUI in stackResults.Children) { itemUI.Opened = opened; } }