Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
When working with a CarouselView it would be great to bind a "SelectedItem" to report the current item which is selected to the ViewModel.
"SelectedItem" should be a bindableproperty obviously.
When the CarouselView is constructed, SelectedItem would have the current item and not a null value.
If you need some other explanation fell free to ask !
Can you not bind to CarouselView.Item? Would you rather it be named SelectedItem?
I apologize, I have read on Xamarin forums that Item property is not bindable so I haven't tried before posting this "bug".
So I have tried and it works partially. By partially I mean that if I swipe the carousel "Item" is updated so it's great.
But there are 2 remaining bugs :
- when constructed, "Item" is not set to the item displayed but it's null. I think "Item" should have the real displayed item.
- when setting "Item" in my viewmodel, carousel does not update its display.
Concerning the name of the property, my preference goes to "SelectedItem" as it more clear than just "Item" but it's up to you.
I fixed the first of your two bugs. I may need a repro to see the second. Probably stick with Item just because that's what we started with.
Duplicate of https://bugzilla.xamarin.com/show_bug.cgi?id=40558?
I attached a repro project when setting Item in ViewModel has no effect on the display.
A button in the View has a command and that command should update the "SelectedItem" property which has to update the carousel display.
With a breakpoint on the "set" in "SelectedItem" property we could see that it's really updated but the carousel display but it doesn't seem to do anything...
I hope this project will help you.
For the naming, we could stay with "Item", it's not a real problem :)
@FieldStrikeMobile : yes it seems that these 2 bugs are closely related but Item is bindable in pre3. Have you tried ?
Created attachment 15838 [details]
Demo bug 40632
I HAVE DELETED ALL PACKAGES TO HAVE A SMALL ZIP SIZE. DON'T FORGET TO RESTORE IT BEFORE STARTING THE PROJECT.
are you sure Item is bindable in pre3? The property item is read only in pre 4
You're right, my error...
In CarouselView, in pre3 I have :
public static readonly BindableProperty ItemProperty;
That explain why display is not updated when I set Item property in ViewModel.
So know it's the same bug as 40558 :)
*** This bug has been marked as a duplicate of bug 40558 ***