InvalidateLayout() public method

public InvalidateLayout ( ) : void
return void
示例#1
0
            public void Remove(UIElement parent, T ui)
            {
                //--------
                //need to remove presentation
                if (parent.CurrentPrimaryRenderElement is IContainerRenderElement parentRenderE)
                {
                    parentRenderE.RemoveChild(ui.GetPrimaryRenderElement());
                }

                //--------
                //need to remove presentation

                //we must ensure linked node is valid
                parent._needContentLayout = true;
                if (ui._collectionLinkNode is LinkedListNode <UIElement> linkedNode)
                {
                    _linkedList.Remove((LinkedListNode <T>)(object) linkedNode);
                }
                else
                {
                    throw new NotSupportedException();
                }


                parent?.InvalidateLayout();
            }
示例#2
0
            public void AddBefore(UIElement parent, T beforeUI, T ui)
            {
                CollectionHelper.CheckUI(parent, ui);

                if (beforeUI._collectionLinkNode is LinkedListNode <UIElement> linkedNode)
                {
                    ui._collectionLinkNode = (LinkedListNode <UIElement>)(object) _linkedList.AddBefore((LinkedListNode <T>)(object) linkedNode, ui);
                    ui.ParentUI            = parent;
                }
                else
                {
                    throw new NotSupportedException();
                }


                //---
                //presentation
                parent._needContentLayout = true;
                if (parent.CurrentPrimaryRenderElement is IContainerRenderElement parentBox)
                {
                    parentBox.InsertBefore(
                        beforeUI.GetPrimaryRenderElement(),
                        ui.GetPrimaryRenderElement());
                    parent?.InvalidateLayout();
                }
            }
示例#3
0
 public static void UpdateLayout <T>(UIElement parent, T ui) where T : UIElement
 {
     if (ui.NeedContentLayout && !ui.IsInLayoutQueue)
     {
         ui.InvalidateLayout();
     }
     parent.InvalidateLayout();
 }
示例#4
0
            public void RemoveAt(UIElement parent, int index)
            {
                T existing = _list[index];

                _list.RemoveAt(index);
                existing.ParentUI = null;//clear link

                RenderElement parentRenderE = parent.CurrentPrimaryRenderElement;

                if (parentRenderE != null)
                {
                    parent.InvalidateLayout();
                }
            }
示例#5
0
            public void AddFirst(UIElement parent, T ui)
            {
                //ui must not have parent before!
                CollectionHelper.CheckUI(parent, ui);
                _linkedList.AddFirst(ui);
                ui.ParentUI = parent;

                //---
                //presentation
                parent._needContentLayout = true;
                if (parent.CurrentPrimaryRenderElement is IContainerRenderElement parentBox)
                {
                    parentBox.AddFirst(ui.GetPrimaryRenderElement());
                    parent?.InvalidateLayout();
                }
            }
示例#6
0
            public void Clear(UIElement parent)
            {
                //clear all child
                //and remove parent linkage
                for (int i = _list.Count - 1; i >= 0; --i)
                {
                    UIElement ui = _list[i];
                    ui.ParentUI = null;
                    UIElement.UnsafeRemoveLinkedNode(ui);
                }
                _list.Clear();

                if (parent.CurrentPrimaryRenderElement is IContainerRenderElement container)
                {
                    container.ClearAllChildren();
                    parent.CurrentPrimaryRenderElement.InvalidateGraphics();
                }
                parent.InvalidateLayout();
            }
示例#7
0
        public void AddChild(UIElement ui)
        {
            if (this.uiList == null)
            {
                this.uiList = new UICollection(this);
            }

            needContentLayout = true;
            this.uiList.AddUI(ui);
            if (this.HasReadyRenderElement)
            {
                primElement.AddChild(ui);
                if (this.panelLayoutKind != BoxContentLayoutKind.Absolute)
                {
                    this.InvalidateLayout();
                }
            }

            if (ui.NeedContentLayout)
            {
                ui.InvalidateLayout();
            }
        }