private static void HideSeparators(ItemsControl ItemCollection, ItemOfBrowser Browser) { ItemCollection Items = ItemCollection.Items; bool Exit = false; for (int i = 0; i < Items.Count && !Exit; i++) { FrameworkElement AsFrameworkElement; if ((AsFrameworkElement = Browser(Items, i) as FrameworkElement) != null) { if (AsFrameworkElement.Visibility == Visibility.Visible) { Separator AsSeparator; if ((AsSeparator = AsFrameworkElement as Separator) != null) { AsSeparator.Visibility = Visibility.Collapsed; } else { Exit = true; } } } else { Exit = true; } } }
private static void HideSeparators(ItemsControl itemCollection, ItemOfBrowser browser) { ItemCollection Items = itemCollection.Items; bool Exit = false; for (int i = 0; i < Items.Count && !Exit; i++) { if (browser(Items, i) is FrameworkElement AsFrameworkElement) { if (AsFrameworkElement.Visibility == Visibility.Visible) { if (AsFrameworkElement is Separator AsSeparator) { AsSeparator.Visibility = Visibility.Collapsed; } else { Exit = true; } } } else { Exit = true; } } }