xamarin-demos icon indicating copy to clipboard operation
xamarin-demos copied to clipboard

SfComboBox in User Control Property value not passed

Open SunshineSpring666 opened this issue 4 years ago • 8 comments
trafficstars

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.

SfComboBoxCustomControl.zip

SunshineSpring666 avatar Mar 10 '21 17:03 SunshineSpring666

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.

Sakthivel-sync avatar Mar 12 '21 04:03 Sakthivel-sync

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.

SunshineSpring666 avatar Mar 12 '21 07:03 SunshineSpring666

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.

  1. In which platform issue was reproduced. Please provide device information if you are using an Android device.
  2. 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.

Suganyasheela avatar Apr 01 '21 05:04 Suganyasheela

Please have the screenshot

SelectedItemImage

Suganyasheela avatar Apr 01 '21 05:04 Suganyasheela

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.

Code Screenshot

Demo Screenshot

Thanks

SunshineSpring666 avatar Apr 01 '21 09:04 SunshineSpring666

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.

AnandRaj32 avatar Apr 08 '21 11:04 AnandRaj32

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.

SunshineSpring666 avatar Apr 09 '21 09:04 SunshineSpring666

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.

Sakthivel-sync avatar Apr 23 '21 10:04 Sakthivel-sync