HknCore
HknCore

Reputation: 139

Can I move a list to the back?

I currently have different DataTemplates in use. For a good looking Layout I have positioned them accordingly. Unfortunately a list with a huge margin value is in front of my Entry. Therefore the Entry is not clickable. Is it possible to push the List behind the Entry with a value. Or is it even possible to insert another blank space that is through clickable?

Pseudo-Layout:

<DataTemplate which is smaller at first and then gets overwritten/>
<Empty Label for Spacing with Margin 70 from top/>
<List/>

Upvotes: 2

Views: 261

Answers (1)

jamesfdearborn
jamesfdearborn

Reputation: 799

EDIT: Your answer might be found in this thread: How do overlap in Xamarin forms?

In short, it doesn't seem like there's a simple way to do it like in WPF. Xamarin (especially XAML in Xamarin) is still a project in progress.

@KeithRome said the following in the thread.

Z-Index is established by the ordering of the Child elements in a container element. The first child is at the back of the Z stack, the second child is placed above it, and so on.

The layout container you are using will dictate how each child is positioned. A StackLayout will not allow overlaps. AbsoluteLayout and RelativeLayout will allow overlaps easily. A Grid will allow overlap for elements that extend into the same row and column. None of these have an appearance of their own (think of them as transparent boxes by default). If you want them to occlude the content behind them, then you will need to assign a background color or image, else they will just be painted right on top of the other content.

Try to get the Entry and List in an Absolute Layout, then simply add the layouts in the order in which the last added element is at the top.

For instance, if I was ordering A, B, and C, and I wanted to have A on top of B on top of C:

<Absolute Layout>
<C/>
<B/>
<A/>
<Absolute Layout/>

Upvotes: 2

Related Questions