Forum Xamarin.Forms


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Relative layout not over lapping other views (Xamarin.Forms)

I am trying to build my own autocomplete control as the ones I tried did not have all the functionality I needed. I simply have the Entry view and a list view which becomes visible when user enters text. This all works fine. However the list when it becomes visible, it pushes the controls below it rather than overlapping them. I have placed the entry and the list in a relative layout. The autocomplete control is then placed within a grid row on the page.

Can someone please guide me on how I can get the list to overlap the view rather than pushing it out of the way.

Below is the code that I have used to place the entry and list in relative layout

            Constraint.RelativeToParent((parent) => { return parent.X; }),
            Constraint.RelativeToParent((parent) => { return parent.Y; }),
            Constraint.RelativeToParent((parent) => { return parent.Width; }),
            Constraint.RelativeToParent((parent) => { return parent.Height; }));

            Constraint.RelativeToView(entText, (parent, view) => { return view.X; }),
            Constraint.RelativeToView(entText, (parent, view) => { return view.Y + 38; }),
            Constraint.RelativeToView(entText, (parent, view) => { return view.Width; }),
            Constraint.RelativeToView(entText, (parent, view) => { return 250; }));

        Content = innerRelativeLayout;


  • StefaanAvonds.3725StefaanAvonds.3725 USMember ✭✭✭

    Are the other controls also placed inside this RelativeLayout?

  • No the other controls are in grid layout. The autocomplete control I am building is a custom control which can be used on any page. Like I said I have an entry and list view that makes up the custom control. Both of these are placed in relative layout. I then want to place the control on any page which will have other controls but mostly in grid layout.

  • JohnMillerJohnMiller USForum Administrator, Xamarin Team Xamurai


    My guess right now is that this is not working as you expect because when you place the control on a Page, it's going to be a RelativeLayout nested inside whatever Content that Page has. Instead, inside your custom control, you would need to access the parent Page and add a RelativeLayout to it for this controls ListView to overlap the Pages content too. That's similar to how this control works.

  • Hi John
    Thanks for our reply but I didnt understand what you were trying to explain. Could you please elaborate.

  • NageshDegilNageshDegil USMember ✭✭


    I'm trying to implement AutoCompleteView in Xamarin forms. When user types some characters in the entry, the overlapping list view should appear on above to Entry field as displayed in screen.
    I implemented logic like when user types input listview should show retarded values.
    Anyone tells what's constraints need to give to Listview in Relative layout.

Sign In or Register to comment.