AutoCompleteView SelectedItem Right Justified When item is too long

0 Answers 130 Views
AutoCompleteView
Vivian
Top achievements
Rank 1
Iron
Vivian asked on 16 Jul 2021, 07:24 PM

Hi Support,

I have a RadAutoCompleteView (see below definitions) and everything works except when the item is too long and it spans 2 rows in the result view. When user selects this long item and the drop down is closed, the selected item text is right aligned in the control. For example, the item shows like this in the drop down box:

1st line - Nursing and residential care facilities

2nd line - and long term care homes

User selects this item and returns to the control, they only see:

"facilities and long term care homes". User will need to press the home button in order to go to the start of the text. 

How do I code it so that the text is automatically left justified once returned from the result view into the control? Please help.

  <telerikInput:RadAutoCompleteView x:Name="MainAutoCompleteSectors" 
                                                              HeightRequest="35"
                                                              NoResultsMessage="No results." 
                                                              BorderThickness="1"
                                                              BorderColor="Silver"
                                                              SuggestionViewHeight="150"
                                                              ItemsSource="{Binding Sectors}"
                                                              TextSearchPath="CombinedName" 
                                                              BackgroundColor="White"
                                                              SuggestMode="Suggest"
                                                              CompletionMode="Contains" 
                                                              Watermark="Start typing here to start search..."
                                                              WatermarkTextColor="Black"
                                                              TextChanged="AutoCompleteSectors_TextChanged"
                                                              FontSize="12"
                                                              SearchThreshold="2"
                                                              TextColor="Black"
                                                              SuggestionItemTextColor="Black"
                                                              SuggestionItemSelected="Handle_SuggestionSectorItemSelected"
                                                              HorizontalOptions="FillAndExpand">
                                            <telerikInput:RadAutoCompleteView.SuggestionItemTemplate>
                                                <DataTemplate>
                                                    <ViewCell>
                                                        <autoCompleteView:SuggestionItemLabel TextColor="Black"
                                                            Padding="5,0"
                                                            HighlightTextColor="{StaticResource OrangeTextColor}"
                                                            UnformattedText="{Binding CombinedName}"
                                                            HighlightText="{Binding Source={x:Reference MainAutoCompleteSectors}, Path=Text}"/>
                                                    </ViewCell>
                                                </DataTemplate>
                                            </telerikInput:RadAutoCompleteView.SuggestionItemTemplate>

                                        </telerikInput:RadAutoCompleteView>

Didi
Telerik team
commented on 19 Jul 2021, 07:04 AM

Could you please send me on which OS device simulator emulator version the behavior can be reproduced? 
I tested on iPhone 12 Simulator iOS 14.4 and no issues with this text: 

            Items.Add(new LongText("Nursing and residential care facilities           ", "           and long term care homes"));
Note that I have added additional space after the fist string and before the second string

Vivian
Top achievements
Rank 1
Iron
commented on 20 Aug 2021, 09:53 PM

Hi Didi, this is in UWP. I have since added a DisplayTextFormatter to return the first 40 characters but would like to see if there is a better approach.
Didi
Telerik team
commented on 23 Aug 2021, 12:27 PM

Hi Vivian, you can use the approach you have found to workaround this issue. 

RadAutoCompleteView uses RadEntry internally, we have been reported a similar issue with the Entry on Android: https://feedback.telerik.com/xamarin/1526678-entry-android-long-text-is-displayed-at-the-ending and the issue happens also inside the AutoCompleteView on Android

Now the behavior is similar but for UWP.  The issue happens only inside the AutoCompleteView control on UWP, in RadEntry there are no issues. 
I have logged this behavior in our feedback portal https://feedback.telerik.com/xamarin/1532685-autocompleteview-android-uwp-when-long-text-is-selected-it-is-displayed-at-the-end 

No answers yet. Maybe you can help?

Tags
AutoCompleteView
Asked by
Vivian
Top achievements
Rank 1
Iron
Share this question
or