Reputation: 129
I attempted to use EventToCommandBehavior like in below examples:
Problem is that the Command bindable property is not being set. I found many articles about similar issues but none of them resolved my problem. Have anyone similar problems?
My event to command behavior class is 1 : 1 like in first url.
My view:
<AbsoluteLayout
VerticalOptions="FillAndExpand"
HorizontalOptions="FillAndExpand"
IsVisible="True">
<WebView
AbsoluteLayout.LayoutBounds="0, 0, 1, 1"
AbsoluteLayout.LayoutFlags="All"
Source ="{Binding WebViewSource}">
<WebView.Behaviors>
<behaviors:EventToCommandBehavior
EventName="Navigating"
EventArgsConverter="{StaticResource WebNavigatingEventArgsConverter}"
Command="{Binding OnWebViewNavigatingCommand}" />
</WebView.Behaviors>
</WebView>
</AbsoluteLayout>
Fragment of the view model:
public ICommand OnWebViewNavigatingCommand => new Command<string>(async (url) => await OnWebViewNavigatingAsync(url));
private async Task OnWebViewNavigatingAsync(string url)
{
// Logic
}
Upvotes: 3
Views: 263