Bug 43007

Summary: Controls nested in StackLayout need to inherit IsEnabled property
Product: Forms Reporter: Clint <clint.stlaurent>
Component: FormsAssignee: Bugzilla <bugzilla>
Severity: enhancement CC: david.ortinau, ehart, jas, jimmy.garrido, jsh001guard-z659, norman.mackay, sahou
Priority: Normal    
Version: 2.3.5   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
Related Links: https://bugzilla.xamarin.com/show_bug.cgi?id=44096
Tags: ac Is this bug a regression?: ---
Last known good build:

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!