Bug 35081 - Calling Grid.Focus does not set focus i.e. Grid.IsFocused is still false
Summary: Calling Grid.Focus does not set focus i.e. Grid.IsFocused is still false
Status: RESOLVED INVALID
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.5.2
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-10-20 05:16 UTC by FieldstrikeMobile
Modified: 2016-01-20 15:30 UTC (History)
4 users (show)

Tags:
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 INVALID

Description FieldstrikeMobile 2015-10-20 05:16:56 UTC
calling

Grid.Focus()

does not set Grid.IsFocused to true

Grid.IsFocused is still false.

Unsure as to whether this is by design or a bug
Comment 1 FieldstrikeMobile 2015-10-30 05:47:57 UTC
Tested on Android only
Comment 2 FieldstrikeMobile 2015-10-30 05:51:07 UTC
Becomes more usefull when trying to set Grid Background on a ListViewItem using Grid.IsFocused in the trigger. For example

                <ListView.ItemTemplate>
                  <DataTemplate>
                    <ViewCell>
                      <ViewCell.View>
                        <Grid>

                          <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="30"/>
                          </Grid.ColumnDefinitions>

                          <StackLayout Grid.Column="0">
                            <Label Text="{Binding Name}"  FontAttributes="Bold"/>
                            <Label Text="{Binding Address, Converter={StaticResource AddressToStringConverter}, ConverterParameter={StaticResource SortAdressLength}}" />
                          </StackLayout>

                          <custom:GridButton Grid.Column="1" Command="{Binding CustomerRecordCard}">
                            <Image Source="Info.png"/>
                          </custom:GridButton>
                          <Grid.Triggers>
                            <Trigger TargetType="Grid" Property="IsFocused" Value="True">
                              <Setter Property="BackgroundColor" Value="#FCA905"/>
                            </Trigger>
                          </Grid.Triggers>
                        </Grid>
                      </ViewCell.View>
                    </ViewCell>
                  </DataTemplate>
                </ListView.ItemTemplate>
Comment 3 Stephane Delcroix 2016-01-20 15:30:01 UTC
You can't Focus() a grid, or any Layout, this doesn't make a lot of UI sense. That's why a call to Focus has that signature:

    public bool Focus ();

and invoking myGrid.Focus () will always returns false.