Bug 43007 - Controls nested in StackLayout need to inherit IsEnabled property
Summary: Controls nested in StackLayout need to inherit IsEnabled property
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms (show other bugs)
Version: 2.3.5
Hardware: PC Windows
: Normal enhancement
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
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:
Status:
RESOLVED FIXED

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.

```xml
                        <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}" />
                        </ContentView>
```
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
https://bugzilla.xamarin.com/show_bug.cgi?id=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
07jul2017
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"
                    Grid.Row="3"
                    Grid.RowSpan="2"
                    Grid.Column="6"
                    BackgroundColor="White"
                    Orientation="Vertical"
                    IsEnabled="False">
          <StackLayout Orientation="Vertical"
                       IsEnabled="False">
            <Label>Fred</Label>
            <Label>Wilma</Label>
            <Label>Pebbles</Label>
            <Label>Dino</Label>
            <Label>Barney</Label>
            <Label>Betty</Label>
            <Label>Bambam</Label>
            <Label>Mr. Slate</Label>
            <Label>Great Gazoo</Label></StackLayout>
        </ScrollView>
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!