xamarin-demos
xamarin-demos copied to clipboard
SfComboBox in User Control Property value not passed
Hi, In some cases we need to put SfComboBox inside custom control for reusability. Some Properties are defined as BindableProperty to pass values in and out of the custom control. The SelectedItem of SfComboBox don't get passed as expected in below demo project, weird. Please take a look at it. Thanks a lot.
Hi @SunshineSpring666 ,
SelectedItem is a BindableProperty but the type is Object, So you can get and set the SelectedItem value directly. Could you please explain more details about what type of issue you have been faced.
Regards, Sakthivel P.
When putting the SfComboBox inside a custom control, the bound value of SelectedItem don't get passed out of the custom control as expected in the rendered Page.
Please see the above attachment link. It's a demo project to show the issue.
Thanks.
Hi @SunshineSpring666,
We can get the SelectedItem of SfComboBox in your application. Please have the screenshot for your reference.
ScreenShot
Since we were not aware for your exact scenario. Could you please share the following information.
- In which platform issue was reproduced. Please provide device information if you are using an Android device.
- Could you please share the replication steps for the issue or issue reproducing video.
This will allow us to investigate further and provide a better solution as soon as possible.
Regards, Suganya Sethuraman.
Please have the screenshot
Hi team, The selected item is expected to get rendered in the green square below. The selected Customer needed to be passed through the Custom Control to the item in the list. Can't figure out what's wrong here.


Thanks
Hi @SunshineSpring666
We suspect that the binding was not proper, and we would suggest changing the binding to a text as per the below code snippet:
<uc:CustomerCard x:Name="customerCard" Customers="{Binding CustomerCandidates, Source={x:Reference this}}" InEdit="{Binding InEdit, Source={x:Reference this}}"/>
<!-- After selecting customer from the custom user control, the Cust doesn't get it's value assigned as expected-->
<Label Text="Selected:" TextColor="Red"/>
<Label Text="{Binding Source={x:Reference customerCard}, Path=Customer.Abbr}"/>
<Label Text="{Binding Source={x:Reference customerCard}, Path=Customer.Company}"/>
Regards, Anand Raj S.
Hi Team, Sorry, I didn't state it clearly. My problem is: I need to make the value actually assigned to the ObservableCollection of OrderQueue when the item in SfComboBox is selected inside the custom control. In other words, the selected customer from CustomerCard doesn't get assigned to the OrderQueue outside the custom control. Thanks a lot.
We would like to discuss more about your issue, so please share your details to [email protected] mail id, which will be helpful for us to proceed further.