AutoComplete cant Close SuggestionViews with button

8 posts, 0 answers
  1. Ahmet
    Ahmet avatar
    16 posts
    Member since:
    Feb 2019

    Posted 13 Mar Link to this post

    Hello,

    I am using Telerik autocomplete and add filter button near autocomplete.If user click filter then autocomplete suggestion(also noResultMessage) must close but it dont.When click filter button then Filter frame opening behind the suggestionView.I want to opening frame in front.

    Telerik Version : 2018.2.620.2 (we will update later)

    here is xaml code

    __________________________________

                <Frame HasShadow="True" Margin="10,10,10,10" HorizontalOptions="FillAndExpand" VerticalOptions="Start" Padding="0" WidthRequest="400">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <telerikInput:RadAutoComplete x:Name="autoCompleteFilter" Grid.Row="0" Grid.Column="0"
                            ItemsSource="" 
                            SuggestionItemSelected=""
                            TextSearchPath=""  
                            CompletionMode="Contains"
                            FontSize="15"
                            Watermark="{Binding FilterHintText}"
                                NoResultsMessage="{translate:Translate  noRecordFound}"                                              
                            BackgroundColor="White" VerticalOptions="Center" >
                            <telerikInput:RadAutoComplete.Effects >
                                <effects:AutoCompleteEffect/>
                            </telerikInput:RadAutoComplete.Effects>
                            <telerikInput:RadAutoComplete.SuggestionViewHeight>
                                <OnPlatform x:TypeArguments="x:Double"
                                    Android="200"
                                    iOS="200" />
                            </telerikInput:RadAutoComplete.SuggestionViewHeight>
                        </telerikInput:RadAutoComplete>
                        <Button Text="" BackgroundColor="White"  WidthRequest="40" HorizontalOptions="End"
                      Command="{Binding OnFilterClick}" Image="FilterIcon.png"  />
                    </Grid>
                </Frame>

         ####When filter clicks,This frame open behind suggestionViews But it must open above suggestionViews
                <Frame BackgroundColor="White" x:Name="FilterSelectionView" HeightRequest="75" IsVisible="{Binding IsFilterVisible}" WidthRequest="100" Padding="0" TranslationY="64" Margin="0,0,15,0" VerticalOptions="Start" HorizontalOptions="End">
                    <StackLayout>
                        <Button  Text="" WidthRequest="70"  HeightRequest="35" BackgroundColor="White" Font="13" Command="{Binding ..}"/>
                        <Button Text="" WidthRequest="70"  HeightRequest="35" BackgroundColor="White" Font="13" Command="{Binding ..}"/>
                    </StackLayout>
                </Frame>

    __________________________________

     

    Here is ViewModel Filter Click Command

    __________________________________

            private void OnFilterClicked(object obj)
            {
                if (radAutoComplete != null)
                    radAutoComplete.Text = string.Empty;    //here is working(It clears string) but suggestion views or noResultMessage dont close

                if (IsFilterVisible)
                {
                    IsFilterVisible = false;
                }
                else
                    IsFilterVisible = true;
            }

    ________________________________

     

    Thank you for your helps

  2. Lance | Technical Support Engineer, Principal
    Admin
    Lance | Technical Support Engineer, Principal avatar
    1036 posts

    Posted 13 Mar Link to this post

    Hi Ahmet,

    You can accomplish that by setting RadAutoComplete.ShowSuggestionsView=False.

    Note that the AutoComplete is now obsolete and we will not be adding any new features of fixes for it as the control is no longer being distributed. We strongly recommend that you use the new AutoCompleteView instead. 

    When you change to the AutoCompleteView, you can get the result you want by using the ShowSuggestions and HideSuggestions methods.

    Regards,
    Lance | Technical Support Engineer, Principal
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. Ahmet
    Ahmet avatar
    16 posts
    Member since:
    Feb 2019

    Posted 13 Mar in reply to Lance | Technical Support Engineer, Principal Link to this post

    Hi Lance,

    Thank you for your feedback.

    Unfortunately RadAutoComplete.ShowSuggestionsView=False is not working.SuggestionView or NoResultMessage still showing. 

  4. Lance | Technical Support Engineer, Principal
    Admin
    Lance | Technical Support Engineer, Principal avatar
    1036 posts

    Posted 13 Mar Link to this post

    Hi Ahmet,

    I suspect there might be an implementation-specific problem (e.g. UI thread access, DataBinding problem,  etc). I also notice that you're using a Custom Platform Effect (to access native control properties?), this can also break connections to the XF APIs.

    To test this, I ignore the rest of the implementation-specific code and just put a Button on the page and directly set autoCompleteFilter.ShowSuggestionView = false. try the attached demo.

    Unfortunately, there were some cases where it doesn't perform in the exact manner you need it to (dynamically). This is one of the main reasons we completely built the new AutoCompleteView control, from the ground up.

    I still recommend swapping it out for the new AutoCompleteView control and use the Methods instead. Most of the properties are the same and shouldn't more than 30 minutes.

    I hope my demo helps.

    Regards,
    Lance | Technical Support Engineer, Principal
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  5. Ahmet
    Ahmet avatar
    16 posts
    Member since:
    Feb 2019

    Posted 18 Mar in reply to Lance | Technical Support Engineer, Principal Link to this post

    Thank you Lance,

    But Unfortunately  its not working on ios.I suspect there is frame conflict.I will change it to AutoCompleteView.I hope it will fix.

  6. Lance | Technical Support Engineer, Principal
    Admin
    Lance | Technical Support Engineer, Principal avatar
    1036 posts

    Posted 18 Mar Link to this post

    Hi Ahmet,

    I've attached a demo to help you get started. In it you'll find an example of an interface that will let you call the ShowSuggesitons and HideSuggestions methods from the view model, but still have 100% MVVM compliance.

    Take the following steps to see the concept in action:

    1. Start typing a name into the ACV
    2. While the SuggestionsView is visible, click the Clear button at the bottom of the page.
    3. Observe the HideSuggestions method is invoked.

    Regards,
    Lance | Technical Support Engineer, Principal
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  7. Ahmet
    Ahmet avatar
    16 posts
    Member since:
    Feb 2019

    Posted 25 Mar Link to this post

    Mr. Lance thank you so much.It's working.But i didnt find that how seperator line of rows removed on ios.Is there any feature in autocompleteview?
  8. Lance | Technical Support Engineer, Principal
    Admin
    Lance | Technical Support Engineer, Principal avatar
    1036 posts

    Posted 25 Mar Link to this post

    Hi Ahmet,

    One of the benefits of the new AutoCompleteView is that you get more control over the templates. 

    I recommend starting at the Templates Overview article to see the rest of the templates you have access to in Xamarin.Forms. Then, to solve this specific request, you could create a custom SuggestionView template and use a different control than a list that has iOS default cell layout.

    Regards,
    Lance | Technical Support Engineer, Principal
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top