Reputation: 147
I want something like
when I am trying this it shows an error saying "Unable to cast object of type 'Xamarin.Forms.Xaml.ElementNode' to type 'Xamarin.Forms.Xaml.ValueNode'."
that means focused event doesn't support binding.But how can I achieve that
Upvotes: 4
Views: 2681
Reputation: 2985
To invoke a command when an event fires, EventToCommandBehavior
might be used; example:
<Entry Text="{Binding Text}">
<Entry.Behaviors>
<behaviors:EventToCommandBehavior EventName="Focused"
Command="{Binding FocusedCommand}" />
</Entry.Behaviors>
</Entry>
See also Event to Command Behavior sample.
Upvotes: 4