protected override void OnChildrenChanged(RadElement child, ItemsChangeOperation changeOperation) { base.OnChildrenChanged(child, changeOperation); RadDropDownMenuElement menuElement = this.FindAncestor <RadDropDownMenuElement>(); if (menuElement == null) { return; } if (changeOperation == ItemsChangeOperation.Inserted || changeOperation == ItemsChangeOperation.Set) { DropDownPosition position = (DropDownPosition)menuElement.GetValue(RadDropDownMenuElement.DropDownPositionProperty); foreach (RadElement element in child.ChildrenHierarchy) { element.SetValue(RadDropDownMenuElement.DropDownPositionProperty, position); } } //This is needed after adding the scrolling support in RadDropDownMenuElement. //since when adding items the scroll layout panel does not invalidate its parent's layout //and thus wrong size of the RadDropDownMenu is calculated, we need to invalidate the //main element's layout explicitly to force recalculation of the popup's size. //This behavior is needed only when adding items in design mode. menuElement.InvalidateMeasure(); }
protected override void OnChildrenChanged( RadElement child, ItemsChangeOperation changeOperation) { base.OnChildrenChanged(child, changeOperation); RadDropDownMenuElement ancestor = this.FindAncestor <RadDropDownMenuElement>(); if (ancestor == null) { return; } if (changeOperation == ItemsChangeOperation.Inserted || changeOperation == ItemsChangeOperation.Set) { DropDownPosition dropDownPosition = (DropDownPosition)ancestor.GetValue(RadDropDownMenuElement.DropDownPositionProperty); foreach (RadObject radObject in child.ChildrenHierarchy) { int num = (int)radObject.SetValue(RadDropDownMenuElement.DropDownPositionProperty, (object)dropDownPosition); } } ancestor.InvalidateMeasure(); }