I have three controls on the left side of a gallery that I want to center within the gallery row as a group.
This sort of works:
Parent.TemplateHeight/2 - (Self.Height+lblApproverName.Height+lblApproverStatus.Height)/2
It works when I set the the TemplateSize to any value that is less than or equal to the math that works. For example, 100 just happens to perfectly work given the size of visible controls.
When that gallery row grows because a label and input that are made invisible and height=0 in certain conditions are visible for some users, the image and labels are in the wrong place.
It seems to always use the integer in the TemplateSize property rather than a dynamic height value based on the current gallery row.
Is there a Gallery property that represents the height of the specific row itself?
I figured this out. There may be another way but what I chose to do is calculate the height of the gallery row by summing the heights of the controls. Since I dynamically shrink the height to zero when the control is NOT visible, the math works.
I also dropped the number into a label so that I could see it changing as I was messing with the math.
Then I simply replaced Parent.TemplateHeight with Value(txtRowHeight.Text).
Shout out to Michelle Sanchez at The Loading Point. It was her YouTube video that solved it for me.
WarrenBelz
146,601
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,942
Most Valuable Professional