internal void ExpandChildren() { SlidingMenuLevel child = FindChildLevel(); if (child != null) { child.Style["display"] = ""; Root.SetActiveLevel(child); } if (!this.IsLeaf) { if (child.EnsureChildNodes()) { child.ReRender(); } Root.SetAllChildrenNonVisible(Root); ASP.Control idxFromThis = child; while (idxFromThis != null && !(idxFromThis is SlidingMenu)) { if (idxFromThis is SlidingMenuLevel) { (idxFromThis as SlidingMenuLevel).Style["display"] = ""; } idxFromThis = idxFromThis.Parent; } // Animating Menu levels... ASP.Control rootLevel = null; foreach (ASP.Control idx in Root.Controls) { if (idx is SlidingMenuLevel) { rootLevel = idx; break; } } Root.BreadCrumb.Style["display"] = "gokk"; // To force a new value to the display property... Root.BreadCrumb.Style["display"] = "none"; new EffectRollOut(rootLevel, Root.BreadCrumb, Root.AnimationDuration) .Render(); } }
private void OpenMenuItem(SlidingMenuItem item, List <string> ids, int totalLevels, bool animate) { // Making sure item has loaded its children SlidingMenuLevel childLevel = item.FindChildLevel(); if (childLevel == null) { // No more items underneath... childLevel = item.Parent as SlidingMenuLevel; totalLevels -= (ids.Count + 1); ids.Clear(); } else { if (childLevel.EnsureChildNodes()) { childLevel.ReRender(); } } // Checking to see if we're finished if (ids.Count == 0) { // Wrapping up... SetAllChildrenNonVisible(this); ASP.Control idxFromThis = childLevel; while (idxFromThis != null && !(idxFromThis is SlidingMenu)) { if (idxFromThis is SlidingMenuLevel) { (idxFromThis as SlidingMenuLevel).Style["display"] = ""; } idxFromThis = idxFromThis.Parent; } // Animating Menu levels... ASP.Control rootLevel = null; foreach (ASP.Control idx in Controls) { if (idx is SlidingMenuLevel) { rootLevel = idx; break; } } BreadCrumb.Style["display"] = "gokk"; // To force a new value to the display property... if (animate) { BreadCrumb.Style["display"] = "none"; } if (ActiveLevel == null) { if (!animate) { ((SlidingMenuLevel)rootLevel).Style[Styles.marginLeft] = "-" + (100 * totalLevels) + "%"; } else { new SlidingMenuItem.EffectRollOut(rootLevel, BreadCrumb, AnimationDuration, false, totalLevels) .Render(); } } else { if (!animate) { ((SlidingMenuLevel)rootLevel).Style[Styles.marginLeft] = "-" + (100 * totalLevels) + "%"; } else { new SlidingMenuItem.EffectRollOut(rootLevel, BreadCrumb, AnimationDuration, true, -1, true) .ChainThese( new SlidingMenuItem.EffectRollOut(rootLevel, BreadCrumb, AnimationDuration, false, totalLevels)) .Render(); } } childLevel.Style["display"] = ""; SetActiveLevel(childLevel); } else { SlidingMenuItem itemNext = Selector.Selector.FindControl <SlidingMenuItem>(childLevel, ids[0]); ids.RemoveAt(0); OpenMenuItem(itemNext, ids, totalLevels, animate); } }