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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

sfCombox barely working (Xamarin/Android)

Thread ID:

Created:

Updated:

Platform:

Replies:

141610 Dec 20,2018 03:38 PM UTC Dec 24,2018 09:06 AM UTC Xamarin.Forms 25
loading
Tags: SfComboBox
Mr Andrew Cope
Asked On December 20, 2018 03:38 PM UTC

I'm changing our XAML to move from a Picker to an sfComboBox and am hitting an annoying brick wall. I have the following XAML:

                                SelectedItem="{Binding SelectedPriorityDto, Mode=TwoWay}" BackgroundColor="{Binding Background}"
                                SelectedValuePath="Name" DisplayMemberPath="Name" FontAttributes="None" Margin="5,5,0,0"
                                IsEnabled="{Binding IsReadOnly, Converter={StaticResource BooleanInverterConverter}}"/>

All I get is an orange box (which is at least correct). But other than the background colour change there's no text, no drop down arrow and nothing happens when it's tapped. Just a whole load of nothing. The original XAML using a picker worked fine:


                       
                                SelectedItem="{Binding SelectedPriorityDto, Mode=TwoWay}" BackgroundColor="{Binding Background}"
                                ItemDisplayBinding="{Binding Name}" FontSize="Medium" FontAttributes="None" Margin="5,5,0,0"
                                IsEnabled="{Binding IsReadOnly, Converter={StaticResource BooleanInverterConverter}}"/>


Mr Andrew Cope
Replied On December 20, 2018 03:44 PM UTC

Your dozy forum software doesn't provide a 'Save' button when editing text so here is the corrected message:


I'm changing our XAML to move from a Picker to an sfComboBox and am hitting an annoying brick wall. I have the following XAML:

     
                                SelectedItem="{Binding SelectedPriorityDto, Mode=TwoWay}" BackgroundColor="{Binding Background}"
                                SelectedValuePath="Name" DisplayMemberPath="Name" FontAttributes="None" Margin="5,5,0,0"
                                IsEnabled="{Binding IsReadOnly, Converter={StaticResource BooleanInverterConverter}}"/>

All I get is an orange box (which is at least correct). But other than the background colour change there's no text, no drop down arrow and nothing happens when it's tapped. Just a whole load of nothing. The original XAML using a picker worked fine:

     
                                SelectedItem="{Binding SelectedPriorityDto, Mode=TwoWay}" BackgroundColor="{Binding Background}"
                                ItemDisplayBinding="{Binding Name}" FontSize="Medium" FontAttributes="None" Margin="5,5,0,0"
                                IsEnabled="{Binding IsReadOnly, Converter={StaticResource BooleanInverterConverter}}"/>


Paul Parkins
Replied On December 20, 2018 03:51 PM UTC

You haven't provide a source of items to be in the list via the Datasource property. Because it doesn't have any items, I assume that's why it won't let you drop down the list.


Mr Andrew Cope
Replied On December 20, 2018 03:56 PM UTC

Good spot, but unfortunately it doesn't make any difference.

I've just tried inserting the XAML from the help page and I don't get anything from that either. Just to give all the information the sfComboBox is part of a DataTemplate:


<DataTemplate x:Key="PriorityMediaEditorInformationTemplate" x:DataType="{x:Type mediaeditorinformation:PriorityMediaEditorInformation}">
                <ViewCell>
                    <Grid ColumnSpacing="0" RowSpacing="0">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <Label Grid.Row="0" Text="{Binding LabelContent}" FontSize="Large" FontAttributes="Bold" LineBreakMode="WordWrap" Margin="5,5,0,0"/>
                        <comboBox:SfComboBox Grid.Row="1" HeightRequest="40" x:Name="comboBox"/>
                    </Grid>
                </ViewCell>
            </DataTemplate>

That shows nothing but the text and a gap underneath.


Mr Andrew Cope
Replied On December 20, 2018 04:20 PM UTC

Just noticed this in the output log:

12-20 15:57:56.192 D/Mono    (11091): AOT: image 'Syncfusion.SfComboBox.Android.dll.so' not found: dlopen failed: library "Syncfusion.SfComboBox.Android.dll.so" not found

It does seem however that the sfComboBox is being loaded because I've confirmed that it is reading some of the properties. It just seems that it can't be bothered to render anything. Out of curiosity could it be because it's being hosted inside a ScrollableListView?

Paul Parkins
Replied On December 20, 2018 04:25 PM UTC

Have you added the SfComboBox to your Android project via NuGet? It's not enough to only add it to the shared .Net project that displays the page using it.

Mr Andrew Cope
Replied On December 20, 2018 04:36 PM UTC

Yup, done that, it shows up in the references. As far as I can tell sfComboBox is just flat out broken in 16.3.0.29.

Mr Andrew Cope
Replied On December 21, 2018 09:59 AM UTC

It's still not working. I'd appreciate some clarity on the references though. For SfCheckBox and SfPopupLayout all I've had to do is add the Nuget package to my Xamarin Forms project. Is that all that's required for SfComboBox? It's really not clear from the documentation but there is evidence that the app has all the DLLs it needs.

The evidence for this is that something is calling the 'Name' property of each of the business objects in the list I'm providing to SfComboBox:

                                DisplayMemberPath="Name"/>

But there's still nothing appearing for the control other than a blank space on the screen. SfCheckBox seems fine, but not SfComboBox. I'll try another control next.

Paul Parkins
Replied On December 21, 2018 10:09 AM UTC

You could try v16.4.x which is now available. 

Post your latest code including the Datasource change, as well as the C# code for the source of the list and SelectItem property and I'll see if I can spot anything.

You do realise I am not actually a Syncfusion employee, just another user? A response from Syncfusion might be handy.


Mr Andrew Cope
Replied On December 21, 2018 10:16 AM UTC

Oh, yes, I realise you're not from Syncfusion :)

I tried to post some XAML but the forum software mangled it. Is there some way to tell the forum I want to insert code? I'll try and post the XAML again:

     <comboBox:SfComboBox Grid.Row="1" DataSource="{Binding Priorities}" DisplayMemberPath="Name" EnableSelectionIndicator="True"
                            SelectedItem="{Binding SelectedPriorityDto, Mode=TwoWay}" SelectedValuePath="Name"/>

The C# is just a class and a view model and they are shared by iOS, Android and WPF.  They work fine with everything except SfComboBox. In fact SfComboBox appears to be accessing the data but just never renders anything. Last night I found that someone else reported that earlier this year but there was no follow-up.

None of this is supposed to be rocket science. I've been working with WPF for a couple of years now and with Xamarin for nearly a year :-/

Mr Andrew Cope
Replied On December 21, 2018 10:19 AM UTC

Hmmm, the XAML got through this time. So here's the code:

In the view model:

     public IEnumerable<PriorityDto> Priorities => MediaConfigurationDto.Values;

And the class:

    public class PriorityDto
    {
        public Guid Id { get; set; }

        public string Name { get; set; }

        public string Highlight { get; set; }

        /// <summary>
        /// The period after which the date media has passed its deadline
        /// </summary>
        public TimeSpan? DeadlinePeriod { get; set; }

        /// <summary>
        /// The period after which the date media enters a warning state
        /// </summary>
        public TimeSpan? WarningPeriod { get; set; }
    }

I've confirmed that something is calling Name.get() and at the moment the only thing that should is the SfComboBox. Plus it gets called when I scroll the SfComboBox into view. There are three priorities and it gets called three times :-/

Paul Parkins
Replied On December 21, 2018 10:23 AM UTC

Yes your C# is just a class, but without seeing it I can't for exampl check you are posting PropertyChanged notifications, or spot anything out of the ordinary. Also I was interested to see the list your DataSource property is based on. You could try changing from

List<MyClass> 

to 

ObservableCollection<Object>

A lot of the Sync examples seem to use ObservableCollection rather than List, and also the other day I learnt that a selection property for one Sync control or another had to be defined to be based upon Object (even though I was putting instances of my own class type in there). This wasn't clear from the Sync docs and I proposed it was made clearer.

Mr Andrew Cope
Replied On December 21, 2018 10:28 AM UTC

Fair point. Currently the underlying collection is a List. I've just created a mobile-specific property that is an ObservableCollection<> and it didn't make any difference. I'll try the most recent Syncfusion version and see if that helps.

Paul Parkins
Replied On December 21, 2018 10:35 AM UTC

So what is MediaConfigurationDto.Values defined as?
Try ObservableCollection<Object>

You might not want to change your DTO, so you could create a local ObservableCollection for Priorites in your model, and populate from MediaConfigurationDto.Values in the constructor. Also this list property, should probably raise a property change in the setter

private ObservableCollection<Object> _Priorites;     // Populate from DTO in constructor
public ObservableCollection<Object> Priorities
{
   get => _Priorities;
   set
   {
       if (_Priorities != value)
       {
              _Priorities = value;
              RaisePropertyChanged(nameof(Priorities));
        }
    }
}


Not sure, but worth a try

Mr Andrew Cope
Replied On December 21, 2018 10:44 AM UTC

Yah, that's how I created the list. I didn't bother with raising a notification, but I've tried that now (with the latest version) and still no change.

But I don't think it's a binding property because something is accessing the name property (can't see what from the call stack) but the point at which it's called, the number of times and the values returned imply that something is building up a list of items. Something also calls the SelectedPriorityDto property twice but doesn't appear to call the Name property on it.

So my current read is that the SfComboBox is just failing to render the initial state.

Paul Parkins
Replied On December 21, 2018 10:47 AM UTC

What's this "SelectedValuePath" property you are attempting to bind? Are you sure such a property exists?
 - For some reason I find it REALLY hard to find the lists of class members for Syncfusion components, which I know is on their site somewhere

In my own project I bind the SelectedItem to a property which is an instance of my object (PriorityDTO for you).
 - I see you have also done this



Mr Andrew Cope
Replied On December 21, 2018 10:50 AM UTC

SelectedValuePath is just something intellisense listed when I was looking. It is mentioned by a Syncfusion employee in this thread:

https://www.syncfusion.com/forums/139934/binding-sfcombobox-selectedvalue-does-not-populate-sfcombobox-text

Mr Andrew Cope
Replied On December 21, 2018 10:58 AM UTC

Right! Something interesting. I dropped an SfComboBox into one of my SfPopupLayouts (just because it's the earliest/easiest place) and it renders. So I think it has something to do with the where the box is. It's currently being displayed as a DataTemplate used by a ScrollableListView.

Also: If SelectedValuePath is not used to specify the member name what is?

Paul Parkins
Replied On December 21, 2018 11:14 AM UTC

Maybe it's related to my own sfCombobox problem

DisplayMemberPath is used (as you are) to indicate which property from the objects to show in the list. Since you are binding SelectedItem, I am not sure you need to use SelectedValue


Mr Andrew Cope
Replied On December 21, 2018 11:23 AM UTC

It sounds similar, yes. I thought I'd try using an SfListView instead of the ScrollableList view and it's hard to see if that's made any difference. For some reason the SfListView is not rendering the templates correctly. It looks as if they are being written over the top of each other as all I can see is the section headings (each DataTemplate starts off with a Label). Although the last of them doesn't show it's SfNumericUpDown either.

Mind you that's another issue I have. SfNumericUpDown only shows the value, not any controls for changing it. That too could perhaps be this same bug.

All in all as an introduction to SyncFusion it's all been pretty naff. The only things I've got working so far are SfPopupLayout (which to be fair does provide us with the pseudo modal dialog we need) and SfCheckBox (and we were indifferent about using that instead of the Xamarin Switch).

It might help if we got some official response from them. They positively hassle you after you've downloaded a trial but once they have your money it seems they no longer want to know.

Mr Andrew Cope
Replied On December 21, 2018 11:59 AM UTC

Well I've created an incident so I suppose it's just a matter of waiting (and I suppose Christmas will get in the way). Unfortunately this is about the only use case we have for Syncfusion so without this there's no point using them.

Dhanasekar R [Syncfusion]
Replied On December 21, 2018 12:00 PM UTC

Hi Andrew,

 
Thanks for your update. 
 
We have validated your query and we are unable to reproduce the reported issue “SfComboBox controls not working correctly in Xamarin Forms Android” from our 16.3.0.29 version. We have prepared the sample based on the given code snippet and placed the SfComboBox control inside the listview DataTemplate. Please have the sample from the below link. 
 
  
Please check our sample and if issue persists in your side, please modify our sample to replicate the issue so that we can give appropriate solution for the reported issue.  
 
While checking the given code snippet, we suspect that combobox control is placed inside a DataTemplate, so can you please update us in which control you are trying to use the combobox control in the DataTemplate. 
 
Regards, 
Dhanasekar 


Paul Parkins
Replied On December 21, 2018 12:01 PM UTC

Actually I find support pretty good (once you have a response from them). In the past if I report a bug and they confirm, they have offered a delivery date for a fix and achieved that date. If you get no response from this thread, then may be try opening an "incident" with them. I am never sure whether I want incident or forum thread, but tend to post in forums so other uses can see the problem, and any helpful responses.

I think your use of DataTemplate may be complicating things. See if you can use a copy of the same combo, outside of the data template, just placed on the page (in a StackLayout maybe). If this appears to work, then I would say it is related to the combo container, as it was for me.

Personally, the Popup support is one aspect of Syncfusion I couldn't get my head around. I know it would do what I wanted, I just found the docs and samples not to be ggod enough. I ended up using the Rg.Plugins popup package instead of Syncfusion.

Mr Andrew Cope
Replied On December 21, 2018 12:09 PM UTC

Okay the sample works for me. I'll see if I can work out what the difference is and get back to you.

Mr Andrew Cope
Replied On December 21, 2018 01:08 PM UTC

Right! I know the cause, and it should be easy to modify the test app you sent. The problem is that any SfComboBox that is initially 'off screen' won't render properly when scrolled into view. You should be able to verify this bug by modifying ComboBox.xaml.cs to create more comboboxes. I modified mine to be:

listView.ItemsSource = new[] { "a", "b", "c",  "a", "b", "c",  "a", "b", "c" };

My version of your app is slightly more complicated because I added a DataTemplateSelector and three templatest but I don't think you need to change your app to that extent. Just add a whole load more comboboxes so that some are off screen initially.

Mr Andrew Cope
Replied On December 24, 2018 09:06 AM UTC

Got a response for my incident and they are hoping to have a fix by 3rd January. That's very impressive support, so I take back my earlier comments :)

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;