Forum Xamarin.Forms

Announcement:

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.

How can I disable StackLayout that can click through?

Hi,
I have a StackLayout at the bottom of my Page, and then I set its TranslationY to -100, it will be cover the ListView which underneath the StackLayout.
When I click the blank on the StackLayout, it will also click the item in the ListView...

So how can I disable this function that can click through of the StackLayout? Thanks.

Best Answer

Answers

  • AdamPAdamP AUUniversity ✭✭✭✭✭

    I believe you are saying that a control that pops up above another control is getting the click instead of the control beneath.

    If that is the case you can use InputTransparent="true" on the control you don't want to take the click.

  • XamerinerXameriner AUMember
    edited October 2015

    @AdamP Thanks for your reply, the solution helps me a lot, but when I set InputTransparent="true" for my StackLayout, all its children are not trigger their click event:

    <StackLayout InputTransparent="true">
        <Entry Text="Something here" />
    </StackLayout>
    

    Could you tell me on this question any further?

  • HarshithaLSHarshithaLS USMember ✭✭


                        </StackLayout>
                    </StackLayout>
    

    private void EnableFavoriteButtons()
    {
    foreach (View child in FavFirstLayout.Children)
    {
    child.IsEnabled = true;
    }

        }
    

    //XAML.cs invoke the below function to enable or disable all children in layout
    private void DisableFavoriteButtons()
    {
    foreach (View child in FavFirstLayout.Children)
    {
    child.IsEnabled = false;
    child.BackgroundColor = Color.Gray;
    }

        }
    
Sign In or Register to comment.