Пример #1
0
        internal void UpdateChips(decimal amount)
        {
            ChipsShape.Content = null;
            ConvertToChips(amount);

            if (!Chips.Any())
            {
                return;
            }

            StackPanel sp = new StackPanel();

            sp.HorizontalAlignment = HorizontalAlignment.Left;
            sp.VerticalAlignment   = VerticalAlignment.Bottom;

            foreach (var chip in Chips)
            {
                for (int j = 0; j < chip.Count; j++)
                {
                    var chipShape = new RadDiagramShape()
                    {
                        Height          = 25,
                        Width           = 25,
                        StrokeThickness = 0,
                        BorderThickness = new Thickness(0),
                        Tag             = "ChipsInfo",
                        Visibility      = Visibility.Visible,
                        DataContext     = chip,
                        Margin          = new Thickness(0, -22, 0, 0),
                        ZIndex          = sp.Children.Count
                    };

                    Binding chipBinding = new Binding(ReflectionHelper.GetPath <ChipModel>(o => o.ChipColor))
                    {
                        Source = chip, Mode = BindingMode.OneTime, Converter = new ColorToChipsConverter(), ConverterParameter = chipShape
                    };
                    chipShape.SetBinding(Control.BackgroundProperty, chipBinding);

                    sp.Children.Insert(0, chipShape);
                }
            }

            ChipsShape.Height  = sp.Height;
            ChipsShape.Content = sp;
        }
 public bool HasContent()
 {
     return(Chips.Count > 0 && Chips.Any(e => string.IsNullOrWhiteSpace(e.Text) == false));
 }