Пример #1
0
        public static void OnItemsSourcePropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs args)
        {
            CollectionStackPanel collectionStackPanel = source as CollectionStackPanel;

            collectionStackPanel.Children.Clear();
            foreach (var item in collectionStackPanel.ItemsSource)
            {
                collectionStackPanel.Children.Add(item);
            }
        }
Пример #2
0
        public static void OnSelectItemPropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs args)
        {
            CollectionStackPanel collectionStackPanel = source as CollectionStackPanel;

            if (collectionStackPanel.SelectItem != null)
            {
                Label lable = collectionStackPanel.SelectItem;
                Color color = new Color();
                color.A          = 255;
                color.R          = 26;
                color.G          = 134;
                color.B          = 243;
                lable.Background = new SolidColorBrush(color);
                color.A          = 255;
                color.R          = 255;
                color.G          = 255;
                color.B          = 255;
                lable.Foreground = new SolidColorBrush(color);
                lable.FontWeight = FontWeights.Heavy;
            }
        }