Hi everyone
I'll start off with providing some context. We're currently working on a project with multiple developers for about a month. As co-authoring isn't yet available in our region, we decided to work with shared component libraries. The idea being that everyone works on his/her own component and subsequently we merge all the components in one master-application.
One component contains a vertical gallery to display tabular data with various controls/fields per row. Within the shared component, everything seems to be working fine. All the "X" and "Width" properties of the rowcontrols/fields are defined relative to the headercontainers.
So far, so good. However, upon importing the library component into an actual PowerApp, everything in the gallery shifts to the left. Trying to figure out why this happened, we edited the component locally (so within the PowerApp) and observed all the widths of the rowcontrols/fields being reset to 1.
Has anyone encountered this issue as well? If so, do you know a way to fix it or is this a bug on PowerApps' side?
Thanks in advance!
Hi @Zeekoe
Use X of the label overlapping this code
Parent.TemplateWidth - Self.Width - 5
This controls shrinking to the width 1 happens to me also sometimes. Usually when I use controls in kind of 'unsupported' scenario. For example when I used nested gallery (in depth 2) in canvas control, every time I forgot myself and tried to move some nested gallery control by drag and drop, all gallery elements were reset to the width 1. Or when I set for the control in gallery Y coordinate to negative number, then when I copy the gallery, it's reset either to 0 or sometimes to 1.
Actually it's a good trick for another scenarios, when for example the horizontal gallery template size is set to 1, X and Y coordinates for child elements are related to Gallery control X, Y and not to the gallery cell, so it's possible to display gallery objects irregularly.
Maybe you could check TemplateSize/TemplateWidth property of gallery in your component, in case it's calculated if you have correct values in render time.
Hi Ramole
Thanks for your response! However if I understand your suggestion correctly, changing the .X-property of the overlapping labels wouldn't lead for the desired effect.
To clarify; imagine the Parent.TemplateWidth being 1000 and there are 5 labels, each having a .Width of 200. I'd like label1.X to be 0 and label1.Width to be 200; label2.X would then be200 and label2.Width would be 200, etc. (but rather than hardcoding it to 200, it receives its values from containers in the header above). If I understand you correctly, label1.X would be (1000-200-5=) 795, same for label2.X, label3.X etc.
Please do tell me if I missed something in your explaination!
Hi LukasKo
I appreciate you input! I did some more testing based on your experiences, unfortunately without finding a real solution. The .TemplateWidth property of the gallery is set to Parent.Width and not used by any of the child controls inside the gallery. I did test the following cases though:
Based on this outcome, I presume the .X and .Width properties get (temporarily) reset when inserting a component onto a canvas app. Is this in line with your experience LukasKo?
Hi @Zeekoe ,
I've browsed my components to find similar one to yours. I've found one, but I don't use there horizontal and vertical container controls, only standard container.
I don't have any problems with shifting controls to the left, but it's maybe because I have icon and text positions as input parameters because I wanted them to be configurable. But the width is calculated and it's working as expected.
Container2.Width = Parent.Width
Gallery1.Width = Parent.Width - 20
btnTitle.Width = Parent.Width
Hi @LukasKo
I think our cases differ a bit too much; I did manage to recreate the issue on a different tenant by applying the following steps:
Do you now reach a similar result?
User | Count |
---|---|
155 | |
93 | |
82 | |
77 | |
58 |
User | Count |
---|---|
195 | |
175 | |
103 | |
96 | |
89 |