From afd08ed0ead8ce327530f45d573d7fd517b0e4f2 Mon Sep 17 00:00:00 2001 From: chenliang624 Date: Fri, 10 Sep 2021 11:18:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=BB=98=E8=AE=A4=E5=B1=95?= =?UTF-8?q?=E5=BC=80=E6=97=B6=EF=BC=8C=E7=BB=98=E5=88=B6=E5=8D=8A=E9=80=89?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SunnyUI/Controls/UITreeView.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SunnyUI/Controls/UITreeView.cs b/SunnyUI/Controls/UITreeView.cs index 6fa36bbd..1e110beb 100644 --- a/SunnyUI/Controls/UITreeView.cs +++ b/SunnyUI/Controls/UITreeView.cs @@ -811,7 +811,7 @@ namespace Sunny.UI } } - if (!DicNodeStatus.Keys.Contains(e.Node.GetHashCode())) + if (!DicNodeStatus.ContainsKey(e.Node.GetHashCode())) { DicNodeStatus.Add(e.Node.GetHashCode(), false); } @@ -947,7 +947,7 @@ namespace Sunny.UI parentNode.Checked = count == parentNode.Nodes.Count; - var half = parentNode.Nodes.Cast().Where(n => DicNodeStatus[n.GetHashCode()]).ToList().Count; + var half = parentNode.Nodes.Cast().Where(n => (DicNodeStatus.ContainsKey(n.GetHashCode()) ? DicNodeStatus[n.GetHashCode()] : false)).ToList().Count; if ((count > 0 && count < parentNode.Nodes.Count) || half > 0) {