Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
 public DropDown()
 {
     OpenPosition = DropDownPosition.Left;
 }