예제 #1
0
        private ClassBreakItem GetClassBreakItem(ClassBreak classBreak)
        {
            var classBreakItem = new ClassBreakItem
            {
                Image         = StyleHelper.GetImageFromStyle(classBreak.CustomStyles.LastOrDefault()),
                StartingValue = classBreak.Value.ToString(),
                ClassBreak    = classBreak
            };

            classBreakItem.PropertyChanged += (s, e) =>
            {
                if (e.PropertyName.Equals("StartingValue"))
                {
                    RaisePropertyChanged(e.PropertyName);
                }
            };

            return(classBreakItem);
        }
        protected override void UpdateUICore(UserControl styleItemUI)
        {
            base.UpdateUICore(styleItemUI);

            var viewModel = styleItemUI.DataContext as ClassBreakStyleViewModel;

            if (viewModel != null)
            {
                viewModel.ClassBreakItems.Clear();
                foreach (var classBreak in Children.Select(i => i.ConcreteObject).OfType <ClassBreak>())
                {
                    ClassBreakItem classBreakItem = new ClassBreakItem();
                    classBreakItem.PropertyChanged += (s, e) => { if (e.PropertyName.Equals("StartingValue"))
                                                                  {
                                                                      UpdateStyleItem();
                                                                  }
                    };
                    classBreakItem.ClassBreak    = classBreak;
                    classBreakItem.StartingValue = classBreak.Value.ToString(CultureInfo.InvariantCulture);
                    classBreakItem.Image         = StyleHelper.GetImageFromStyle(classBreak.CustomStyles);
                    viewModel.ClassBreakItems.Add(classBreakItem);
                }
            }
        }
예제 #3
0
 private double GetSize(ClassBreakItem itemViewModel)
 {
     return(itemViewModel.ClassBreak.Value);
 }