Bug 59486 - [UWP] Inside ListView Entry focus not being set IsFocused
Summary: [UWP] Inside ListView Entry focus not being set IsFocused
Status: RESOLVED NORESPONSE
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.3.4
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-09-14 09:39 UTC by Jitendra Jadav
Modified: 2017-10-17 15:01 UTC (History)
2 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 NORESPONSE

Description Jitendra Jadav 2017-09-14 09:39:43 UTC
Inside Listview I have custom Cell which has Entry which I am trying to bind IsFocused property of this entry but it is not being set

My Entry for scan Item is here: 

<behaviors:MyEntry
                    x:Name="scannedEntry"
                    Grid.Column="0"
                    Margin="5,0,10,0"
                    Placeholder="Scan Item..."
                    BackgroundColor="#FFFFFF"
                    VerticalOptions="FillAndExpand"
                    Text="{Binding Barcode}"
                    Focused="Barcode_Focused"
                    FontSize="12">
                    <behaviors:MyEntry.Behaviors>
                        <behaviors:EventToCommandBehavior
                            EventName="Completed"
                            Command="{Binding AddItemCommand}"/>
                    </behaviors:MyEntry.Behaviors>
                </behaviors:MyEntry>

My Listview looks like this:

<ListView
                Grid.Row="2"
                Grid.ColumnSpan="8"
                x:Name="listView"
                HasUnevenRows="True"
                CachingStrategy="RecycleElement"
                ItemsSource="{Binding BarcodeDetailList}"
                SelectedItem="{Binding SelectedBarCodeRecord,Mode=TwoWay}">

                <ListView.Behaviors>
                    <!--<behaviors:EventToCommandBehavior
                        EventName="ItemTapped" 
                        Command="{Binding ListViewItemTappedCommand}" />-->

                    <behaviors:EventToCommandBehavior
                          EventName="ItemSelected"
                          Command="{Binding ListViewItemTappedCommand}"/>

                </ListView.Behaviors>

                <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell Height="40">

                            <Grid
                                BackgroundColor="{Binding BackgroundColor}"
                                VerticalOptions="Center"
                                RowSpacing="0"
                                ColumnSpacing="5">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="39"/>
                                    <RowDefinition Height="1"/>
                                </Grid.RowDefinitions>

                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="1.5*"/>
                                    <ColumnDefinition Width="3*"/>
                                    <ColumnDefinition Width="1.5*"/>
                                    <ColumnDefinition Width="1*"/>
                                    <ColumnDefinition Width="1.5*"/>
                                    <ColumnDefinition Width="1.5*"/>
                                    <ColumnDefinition Width="Auto"/>
                                </Grid.ColumnDefinitions>

                                
                                <Custom:MyEntry
                                    x:Name="Qty"
                                    IsEnabled="{Binding IsQtyEditable}"
                                    Margin="-20,0,0,0"
                                    BackgroundColor="White"
                                    VerticalOptions="Center"
                                    HorizontalTextAlignment="End"
                                    HorizontalOptions="End"
                                    Grid.Column="4"
                                    NeedToFocus="{Binding IsFocusSelected}"
                                    IsFocused="{Binding IsFocusSelected}"
                                    Keyboard="Numeric" 
                                    Text="{Binding Quantity,Mode=TwoWay}">
                                    <Entry.Behaviors>
                                        <behaviors:EventToCommandBehavior
                                            EventName="Completed"
                                            Command="{Binding Path=BindingContext.UpdateScannedItemCommand,Source={x:Reference Name=listView}}"/>
                                    </Entry.Behaviors>
                                    <Entry.Triggers>
                                        <Trigger TargetType="Entry" Property="IsFocused" Value="True">
                                            <Setter Property="BackgroundColor" Value="Yellow" />
                                        </Trigger>
                                    </Entry.Triggers>
                                </Custom:MyEntry>
                             
                            </Grid>
                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>Flow :

1. Take Enrty above of Listview and fire command of "Completed" event of entry which add ListView Items
2. Once ListView Item added Focus needs to set added Item's Entry so I can changes Text of this Entry
Comment 1 Jitendra Jadav 2017-09-14 09:44:51 UTC
Sorry forgot to add more info :

Microsoft Visual Studio Community 2017 Preview (2)
Version 15.4.0 Preview 2.0
VisualStudio.15.Preview/15.4.0-pre.2.0+26906.1
Microsoft .NET Framework
Version 4.7.02046

Installed Version: Community

Visual Basic 2017   00369-60000-00001-AA128
Microsoft Visual Basic 2017

Visual C# 2017   00369-60000-00001-AA128
Microsoft Visual C# 2017

Visual C++ 2017   00369-60000-00001-AA128
Microsoft Visual C++ 2017

Xamarin   4.7.0.934 (d68a92f)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android SDK   7.5.0.15 (HEAD/cf9532456)
Xamarin.Android Reference Assemblies and MSBuild support.

Xamarin.iOS and Xamarin.Mac SDK   10.14.0.26 (416f778)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.



Note : Once I bound NeedToFocus BindableProperty then it will work but not 100%
it will work in 90% and 10% got failed
Comment 2 Paul DiPietro [MSFT] 2017-09-14 13:28:16 UTC
Could you please upload a full reproduction solution as it appears we would not have your actual custom code. Can you also please verify that this behavior still occurs as of the 2.4.0-pre2 build? Thanks!
Comment 3 Paul DiPietro [MSFT] 2017-10-17 15:01:27 UTC
Marking as no response as we have not heard back for over 30 days. Please reopen this with a minimized reproduction project per the above comment's request if this is still occurring on the latest 2.4.0 stable build of Forms. Thanks!