-
Notifications
You must be signed in to change notification settings - Fork 779
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
$selectedItem does not appear to be implemented #319
Comments
You're right it's not currently implemented in the base library and I lifted it from a sample it's something I think we'll add in a upcoming version. Thanks for bringing this to my attention. |
Awesome, I look forward to it. |
this fix would be more broadly applicable
|
There's one major problem with implementing
We can do it with |
I've implemented |
What's the current workaround for XForms? The syntax is still referenced in the updated samples: Caliburn.Micro/samples/features/Features.Forms/Features.Forms/Views/MenuView.xaml Line 14 in 79724b8
|
The sample itself creates the implementation in I'm not keen on adding it to the framework due to the stateful nature of I'll double check this in later versions of the Forms across multiple platforms and if it's good then I'll add it in. |
Thanks! I missed the added special value configuration. |
Is there a reason why the event args can not be used? Is this also not supported with Caliburn + XForms? The value of forms:Message.Attach="[Event ItemSelected] = [NavigateToItemAsync($selectedItem)]" MessageBinder.SpecialValues.Add("$selecteditem", c =>
{
var eventArgs = c.EventArgs as SelectedItemChangedEventArgs;
return eventArgs?.SelectedItem;
}); Is this the issue you referred to above with |
Yup, first a bit of internals. They way Caliburn.Micro works is taking the string
Where
One of the differences between Xamarin.Forms and the others (such as UWP) is the interface between the trigger and the action. Specifically on the Microsoft developed platforms there's an optional argument passed to the action (which we enter into Xamarin.Forms however doesn't have that parameter. The interface itself doesn't allow this to be passed between the two. It's unfortunate but it will require a change to Xamarin.Forms to deal with this. |
Hi, I am using CM for Xamarin Forms for android and iOS with Autofac as DI replacement.
I went through http://caliburnmicro.com/announcements/3.0.0 and in there was a snippet of using ListView with selected item.
<ListView ItemsSource="{Binding Features}" HasUnevenRows="True" cm:Message.Attach="[Event ItemSelected] = [ShowFeature($selectedItem)]">
I found that $selectedItem is not working and upon further inspect, I can concluded it's not implemented at all in MessageBinder. For the moment I have added the following to get it working.
MessageBinder.SpecialValues.Add("$selecteditem", context => { var lv = context.Source as ListView; return lv?.SelectedItem; });
Using safe cast instead of reflection because afaik ListView is the only with this property.
Is this feature deprecated/remove/missed/incorrectly documented/implemented/some other? or have I missed something?
Thanks.
The text was updated successfully, but these errors were encountered: