Focus is not set when working with combobox

When using sfComboBox+sfTextInputLayout if sfComboBox's IsEditableMode setted to 'False' then clicking on ComboBox don't applies focused styles to sfTextInputLayout.

3 Replies

SS Sridevi Sivakumar Syncfusion Team June 14, 2021 01:17 PM UTC

Hi Kyrylo Rudenko,

Greetings from Syncfusion.

We have analysed the reported query. SfTextInputLayout is a layout control that displays and decorates the input view. Hence the focus changed will be occurred to the input control only.

To achieve your requirement, apply the style to SfTextInputLayout, by using the SfComboBox Focused and UnFocused events as you see in the below code snippet.

[XAML]:
 
  <ContentPage.Resources> 
        <ResourceDictionary> 
           <Style x:Key="FocusedStyle" TargetType="inputLayout:SfTextInputLayout"> 
                    <Setter Property="ContainerBackgroundColor" Value="Yellow" /> 
                </Style> 
            <Style x:Key="UnFocusedStyle" TargetType="inputLayout:SfTextInputLayout"> 
                <Setter Property="ContainerBackgroundColor" Value="Red" /> 
            </Style> 
        </ResourceDictionary> 
    </ContentPage.Resources> 
    <ContentPage.Content> 
            <inputLayout:SfTextInputLayout x:Name="textInput"   Hint="ComboBox"> 
                <combobox:SfComboBox  IsEditableMode="False" SelectedItem="Uganda" Unfocused="SfComboBox_Unfocused"  Focused="SfTextInputLayout_Focused"> 
     ... 
                </combobox:SfComboBox> 
  
            </inputLayout:SfTextInputLayout> 
    </ContentPage.Content> 

[C#]:
 
        private void SfTextInputLayout_Focused(object sender, FocusEventArgs e) 
        { 
            textInput.Style = (Style)this.Resources["FocusedStyle"]; 
        } 
  
        private void SfComboBox_Unfocused(object sender, FocusEventArgs e) 
        { 
            textInput.Style = (Style)this.Resources["UnFocusedStyle"]; 
        } 

Please have a sample from below link
https://www.syncfusion.com/downloads/support/directtrac/general/ze/GettingStarted663980230

Focused and UnFocused Style is applying properly in XForms Android and UWP, but not in iOS platform while setting the SfComboBox IsEditableMode to false. Can please confirm whether you are facing the problem is same as mentioned in above scenario?

Regards,
Sridevi S. 
 



CF Carlton Flores June 30, 2021 09:45 AM UTC

actually i am also kind of same issue. vidmate w3toys



SS Sridevi Sivakumar Syncfusion Team July 1, 2021 01:23 PM UTC

Hi Kyrylo Rudenko,

We have tried to check the reported problem with the provided link, but we can’t open the link and access was denied.

In our Syncfusion website, there is option to upload a file. Can you please update your attachment using that option.?



Regards,
Sridevi S. 

Loader.
Up arrow icon