Ejemplo n.º 1
0
        private static void OnIsCheckedPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if ((d is TagFamily) && (((bool?)e.NewValue).HasValue))
            {
                foreach (Tag tag in (d as TagFamily).Members)
                {
                    //tag.IsTagChecked = true;
                    ItemHelper.SetIsChecked(tag, (bool?)e.NewValue);
                }
            }

            if (d is Tag)
            {
                ItemHelper.CheckParent((d as Tag));
            }
        }
Ejemplo n.º 2
0
        public static void CheckParent(Tag d)
        {
            int check   = ((d as Tag).GetValue(ItemHelper.ParentProperty) as TagFamily).Members.Where(x => ItemHelper.GetIsChecked(x) == true).Count();
            int uncheck = ((d as Tag).GetValue(ItemHelper.ParentProperty) as TagFamily).Members.Where(x => ItemHelper.GetIsChecked(x) == false).Count();

            if (check > 0 && uncheck > 0)
            {
                ItemHelper.SetIsChecked((d as Tag).GetValue(ItemHelper.ParentProperty) as DependencyObject, null);
                return;
            }
            if (check > 0)
            {
                ItemHelper.SetIsChecked((d as Tag).GetValue(ItemHelper.ParentProperty) as DependencyObject, true);
                return;
            }
            ItemHelper.SetIsChecked((d as Tag).GetValue(ItemHelper.ParentProperty) as DependencyObject, false);
        }