We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

How to fill SfAutoComplete in the Horizontal StackLayout

  <StackLayout Orientation="Horizontal"  Padding="7,5,5,0">
            <StackLayout HorizontalOptions="StartAndExpand" VerticalOptions="Start">
                <autocomplete:SfAutoComplete HeightRequest="40" />
            </StackLayout>
            <Button  x:Name="viewModeChangeBtn" VerticalOptions="Start" WidthRequest="50"  HeightRequest="40" TextColor="White" BackgroundColor="#F8B4C3"
                          Text="List" />
            <Button  x:Name="viewFilterBtn"  VerticalOptions="Start" WidthRequest="50" HeightRequest="40" TextColor="White" BackgroundColor="#F8B4C3"
                          Text="Filter" />
        </StackLayout>


I'm trying to fill the SfAutoComplete in StackLayout for iPhone and iPad.
Fixed width value is working for SfAutoComplete but I don't know how to set auto width like StartAndExpand for SfAutoComplete .
Please help me.

Thanks in advance.


5 Replies

VA Vanaja  Annasamy Syncfusion Team September 8, 2017 09:47 AM UTC

uHi Spark, 
  
Thank you for contacting Syncfusion support. 
  
We suggest you to set Orientation of StackLayout into Vertical to fill the SfAutoComplete in StackLayout. We have created the sample for the reference in which HorizontalOption of SfAutoComplete is set StartAndExpand so that AutoComplete is expanded to fill in the StackLayout. Please download the same from the below link. 
  
  
Please run the sample and revert whether if you have any concern on this. 
  
Regards, 
Vanaja R.A. 



SP spark September 11, 2017 11:38 PM UTC

Thank you for reply.

I want to make Autocomplete and 2 Buttons in one line. so I need to set Horizontal for Stacklayout.

But don't worry I already solved this problem like this.  If any better solution, please let me know.

Thanks,

  <StackLayout Orientation="Horizontal"  Padding="7,5,5,0" x:Name="autocompleteStack" >
            <StackLayout HorizontalOptions="StartAndExpand" VerticalOptions="Start">
                <autocomplete:SfAutoComplete HeightRequest="40"  x:Name="autoComplete" />
            </StackLayout>
            <Button  x:Name="viewModeChangeBtn" VerticalOptions="Start" WidthRequest="50"  HeightRequest="40" TextColor="White" BackgroundColor="#F8B4C3"
                          Text="List" />
            <Button  x:Name="viewFilterBtn"  VerticalOptions="Start" WidthRequest="50" HeightRequest="40" TextColor="White" BackgroundColor="#F8B4C3"
                          Text="Filter" />
  </StackLayout>




        private void AutocompleteStack_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "Width")
                autoComplete.WidthRequest = autocompleteStack.Width - 125;
        }






SK Selva Kumar  Veerakrishnan Syncfusion Team September 12, 2017 01:50 PM UTC

Hi Spark,

Thanks for your response.

We have modified the sample with the Grid. In that we have used our SfAutoComplete control and the two buttons in a same row. Please download the sample from the link given below.

Link: http://www.syncfusion.com/downloads/support/directtrac/general/ze/SfAutoComplete_LayoutOption356139447.zip

Please let us know if you have any concern on this.

Regards,
Selva Kumar V


SP spark September 13, 2017 11:59 PM UTC

It also works fine. Thank you.




PR Padmini Ramamurthy Syncfusion Team September 14, 2017 12:10 PM UTC

Hi Spark, 
  
Thanks for your response and please get back to us if you need any other assistance on this. 
  
Regards, 
Padmini R. 


Loader.
Live Chat Icon For mobile
Up arrow icon