Bug 43007 - Controls nested in StackLayout need to inherit IsEnabled property
Summary: Controls nested in StackLayout need to inherit IsEnabled property
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.3.5
Hardware: PC Windows
: Normal enhancement
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-08-02 18:38 UTC by Clint
Modified: 2017-08-30 18:37 UTC (History)
7 users (show)

Tags: ac
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Clint 2016-08-02 18:38:07 UTC
Related to 42195

A nested control should not be enabled if the parent control IsEnabled=false

For example, if I have one or more controls in a StackLayout, and that StackLayout is NOT enabled then all the controls within should not receive input, should not react to taps etc.  However, that's not the case.

                        <ContentView IsEnabled="{Binding IsMultiPage, Converter={StaticResource BoolInvertConverter}}">
                            <Button BackgroundColor="{StaticResource TileScans}"
                                    Command="{Binding AcceptScanCommand}"
                                    CommandParameter="{Binding SelectedPendingImagePath}"
                                    IsEnabled="{Binding SelectedPendingImagePath,
                                                        Converter={StaticResource StringNullOrEmptyBoolConverter}}"
                                    Text="{StaticResource Accept}"
                                    TextColor="{StaticResource SecondaryTextColor}"
                                    Style="{StaticResource ButtonStyleLrg}" />
In this example, if the ContentView works out to IsEnabled=false, then I should not be able to tap the button - but I can, executing the command attached to the button.

This is basic expected behavior from WPF that needs to work in the same way in Xamarin.
Comment 1 Clint 2016-11-23 15:25:38 UTC
Re-reported a month later as 44096

Seems to be addressed in Xamarin.Forms 2.3.4pre-1 in Nov2016
Comment 2 Jimmy [MSFT] 2017-02-23 19:03:31 UTC

*** This bug has been marked as a duplicate of bug 44096 ***
Comment 3 Clint 2017-07-07 18:49:44 UTC
Still broken in 2.3.5-pre6 - yes 6.

Simple example with the scrollview disabled and the StackLayout also disabled will still allow the user to scroll up and down.

        <ScrollView x:Name="testScroll"
          <StackLayout Orientation="Vertical"
            <Label>Mr. Slate</Label>
            <Label>Great Gazoo</Label></StackLayout>
Comment 4 E.Z. Hart [MSFT] 2017-07-10 17:03:44 UTC
This has nothing to do with being nested; ScrollViews on Android and iOS are just ignoring the IsEnabled property. It's a separate bug, fixed by https://github.com/xamarin/Xamarin.Forms/pull/1049.
Comment 5 John Hardman 2017-08-30 17:16:14 UTC
Just to confirm that this is not working in 2.3.4 stable - I've just set IsEnabled on a RelativeLayout to false, and a Switch inside the RelativeLayout still functions.

Is the PR mentioned above expected to fix this scenario?
Comment 6 Jimmy [MSFT] 2017-08-30 18:37:03 UTC
@John The PR in comment 4 is in 2.4.0-pre1, but not 2.3.4. Can you re-test your scenario with the latest pre-release and let us know if it's fixed or not? Thanks!