private void HandleExpandExecuted(object obj) { TreeItem ti = (TreeItem)obj; if (ti == null) { return; } if (ti.IsFullyLoaded) { return; } ti.Children.Clear(); string path = ti.GetFullPath(); DirectoryInfo di = new DirectoryInfo(path); try { foreach (DirectoryInfo sub in di.GetDirectories()) { TreeItem item = new TreeItem(sub.Name, ti); item.Children.Add(new TreeItem(_emptyName, item)); ti.Children.Add(item); } } catch (UnauthorizedAccessException ex) { ti.Forbidden = true; CheckSelected(); } ti.IsFullyLoaded = true; }