Exemplo n.º 1
0
        /*
         * 父元素回溯一步一步检测递归
         * 子元素集合迭代复制处理
         *
         */
        public override void CheckedChanged()
        {
            bool currentChecked = this.IsChecked;
            //迭代处理子元素
            List <InnerCheckItem> tempItems = new List <InnerCheckItem>();

            tempItems.AddRange(this.Items);
            for (int i = 0; i < tempItems.Count; i++)
            {
                InnerCheckItem tempItem = tempItems[i];
                tempItem.IsChecked = currentChecked;

                InnerCheckItemCollection tempCollection = tempItem as InnerCheckItemCollection;
                if (tempCollection != null)
                {
                    tempItems.AddRange(tempCollection.Items);
                }
            }

            base.CheckedChanged();
        }
Exemplo n.º 2
0
 public void AddItem(InnerCheckItem item)
 {
     item.Prarent = this;
     this.Items.Add(item);
 }