From 3793a9a38ac6c4c4111c2bba3a35a71c30601e82 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期一, 13 四月 2020 19:38:24 +0800 Subject: [PATCH] 上传个东西 --- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalFrameControl.cs | 86 ++++++++++++++++++++++++++++++++----------- 1 files changed, 64 insertions(+), 22 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalFrameControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalFrameControl.cs index f0f6360..f2add7e 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalFrameControl.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalFrameControl.cs @@ -5,7 +5,7 @@ namespace Shared.Phone.UserCenter { /// <summary> - /// 鍋氭垚涓�涓噷闈㈠彧瑁匜rameLayout鐨勫垪琛ㄥ瀷鎺т欢(瀹冧笉浼氳皟鏁撮珮搴�) + /// 鍋氭垚涓�涓噷闈㈠彧瑁匜rameLayout鐨勫垪琛ㄥ瀷鎺т欢(瀹冧笉浼氳皟鏁撮珮搴�,鏈夋甯�) /// </summary> public class VerticalFrameControl : VerticalScrolViewLayout { @@ -18,7 +18,18 @@ /// <summary> /// 妗屽竷鎺т欢 /// </summary> - private FrameLayout frameTable = null; + private FrameLayout m_frameTable = null; + /// <summary> + /// 妗屽竷鎺т欢 + /// </summary> + public FrameLayout frameTable + { + get + { + if (m_frameTable == null) { this.InitFrameTable(); } + return m_frameTable; + } + } #endregion @@ -38,14 +49,14 @@ /// </summary> private void InitFrameTable() { - if (this.frameTable != null) + if (this.m_frameTable != null && this.m_frameTable.Parent != null) { return; } - this.frameTable = new FrameLayout(); - this.frameTable.Width = this.Width; - this.frameTable.Height = this.Height; - this.AddChidren(this.frameTable); + this.m_frameTable = new FrameLayout(); + this.m_frameTable.Width = this.Width; + this.m_frameTable.Height = this.Height; + this.AddChidren(this.m_frameTable); } #endregion @@ -61,16 +72,16 @@ //鍒濆鍖栨甯冩帶浠� this.InitFrameTable(); - var child = this.frameTable.GetChildren(this.frameTable.ChildrenCount - 1); + var child = this.m_frameTable.GetChildren(this.m_frameTable.ChildrenCount - 1); if (child != null) { frame.Y = child.Bottom + rowSpace; } - this.frameTable.AddChidren(frame); + this.m_frameTable.AddChidren(frame); //璋冩暣妗屽竷楂樺害 - if (this.frameTable.Height < frame.Bottom) + if (this.m_frameTable.Height < frame.Bottom) { - this.frameTable.Height = frame.Bottom; + this.m_frameTable.Height = frame.Bottom; } } @@ -85,13 +96,14 @@ /// <param name="buttomSpace">搴曢儴绌虹櫧闂磋窛(鐪熷疄鍊�)</param> public void AdjustChidrenFrameHeight(FrameLayout frame, int buttomSpace) { - var child = frame.GetChildren(frame.ChildrenCount - 1); - if (child != null) + //鑾峰彇鍧愭爣搴曢儴鏈�涓嬮潰鐨勯偅涓帶浠剁殑搴曢儴鍧愭爣 + int value = this.GetLocationMostLastViewBottom(); + if (value != -1) { //璋冩暣妗屽竷楂樺害 - if (frame.Height < child.Bottom + buttomSpace) + if (frame.Height < value + buttomSpace) { - frame.Height = child.Bottom + buttomSpace; + frame.Height = value + buttomSpace; } } } @@ -101,14 +113,12 @@ /// </summary> public void AdjustTableHeight() { - var child = this.frameTable?.GetChildren(this.frameTable.ChildrenCount - 1); - if (child != null) + //鑾峰彇鍧愭爣搴曢儴鏈�涓嬮潰鐨勯偅涓帶浠剁殑搴曢儴鍧愭爣 + int value = this.GetLocationMostLastViewBottom(); + if (value != -1) { //璋冩暣妗屽竷楂樺害 - if (this.frameTable.Height < child.Bottom) - { - this.frameTable.Height = child.Bottom; - } + this.m_frameTable.Height = value; } } @@ -119,7 +129,7 @@ public void AdjustRealHeightByBottomButton(int correctionsValue = 0) { var btnTemp = new BottomClickButton(); - if (btnTemp.Yaxis >= this.frameTable.Height + correctionsValue) + if (btnTemp.Yaxis >= this.m_frameTable.Height + correctionsValue) { //娌℃湁瓒呰繃 return; @@ -130,6 +140,38 @@ this.AddChidrenFrame(frameBackTemp); } + /// <summary> + /// 杩樺師妗屽竷楂樺害 + /// </summary> + public void RecoverTableHeight() + { + if (this.m_frameTable != null) + { + m_frameTable.Height = this.Height; + } + } + + /// <summary> + /// 鑾峰彇鍧愭爣搴曢儴鏈�涓嬮潰鐨勯偅涓帶浠剁殑搴曢儴鍧愭爣 + /// </summary> + /// <returns></returns> + private int GetLocationMostLastViewBottom() + { + int bottomHeight = -1; + + if (this.m_frameTable == null) { return bottomHeight; } + + for (int i = 0; i < this.m_frameTable.ChildrenCount; i++) + { + var child = this.m_frameTable.GetChildren(i); + if (child.Bottom > bottomHeight) + { + bottomHeight = child.Bottom; + } + } + return bottomHeight; + } + #endregion } } -- Gitblit v1.8.0