Skip to content

Commit

Permalink
Fix Issue #9
Browse files Browse the repository at this point in the history
  • Loading branch information
nuitsjp committed Apr 3, 2019
1 parent cd05f67 commit fc394f5
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/BehaviorsSampleApp/BehaviorsSampleApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,10 @@
<ItemGroup>
<ProjectReference Include="..\Xamarin.Forms.BehaviorsPack\Xamarin.Forms.BehaviorsPack.csproj" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="Views\WebViewPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>
</Project>
15 changes: 15 additions & 0 deletions src/BehaviorsSampleApp/ViewModels/WebViewPageViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Input;
using Xamarin.Forms;

namespace BehaviorsSampleApp.ViewModels
{
public class WebViewPageViewModel
{
public Command<string> NavigatedCommand => new Command<string>(x =>
{
});
}
}
1 change: 1 addition & 0 deletions src/BehaviorsSampleApp/Views/MenuPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<Button Text="SelectedItemBehavior Sample" Clicked="SelectedItemBehavior_OnClicked"/>
<Button Text="SelectedItemAttachedProperty Sample" Clicked="SelectedItemAttachedProperty_OnClicked"/>
<Button Text="ClearSelectedItemAttachedProperty Sample" Clicked="ClearSelectedItemAttachedProperty_OnClicked"/>
<Button Text="WebView Sample" Clicked="WebView_Clicked"/>
</StackLayout>
</ScrollView>
</ContentPage>
5 changes: 5 additions & 0 deletions src/BehaviorsSampleApp/Views/MenuPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,10 @@ private void ClearSelectedItemAttachedProperty_OnClicked(object sender, EventArg
{
Navigation.PushAsync(new ClearSelectedItemAttachedPropertyPage());
}

private void WebView_Clicked(object sender, EventArgs e)
{
Navigation.PushAsync(new WebViewPage());
}
}
}
32 changes: 32 additions & 0 deletions src/BehaviorsSampleApp/Views/WebViewPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:behaviorsPack="clr-namespace:Xamarin.Forms.BehaviorsPack;assembly=Xamarin.Forms.BehaviorsPack"
xmlns:viewModels="clr-namespace:BehaviorsSampleApp.ViewModels"
x:Class="BehaviorsSampleApp.Views.WebViewPage">
<ContentPage.BindingContext>
<viewModels:WebViewPageViewModel/>
</ContentPage.BindingContext>
<ContentPage.Content>
<StackLayout>
<Label Text="Welcome to Xamarin.Forms!"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand" />
</StackLayout>
</ContentPage.Content>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Button Text="Navigate"/>
<WebView Grid.Row="1"
Source="https://www.google.com">
<WebView.Behaviors>
<behaviorsPack:EventToCommandBehavior Command="{Binding NavigatedCommand}"
EventArgsPropertyPath="Url"
EventName="Navigated" />
</WebView.Behaviors>
</WebView>
</Grid>
</ContentPage>
20 changes: 20 additions & 0 deletions src/BehaviorsSampleApp/Views/WebViewPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Xamarin.Forms;
using Xamarin.Forms.Xaml;

namespace BehaviorsSampleApp.Views
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class WebViewPage : ContentPage
{
public WebViewPage()
{
InitializeComponent();
}
}
}
2 changes: 1 addition & 1 deletion src/Xamarin.Forms.BehaviorsPack/CommandExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void Execute(ICommand command, object commandParameter = null, EventArgs
object propertyValue = eventArgs;
foreach (var propertyPathPart in propertyPathParts)
{
var propInfo = propertyValue.GetType().GetTypeInfo().GetDeclaredProperty(propertyPathPart);
var propInfo = propertyValue.GetType().GetTypeInfo().GetProperty(propertyPathPart);
propertyValue = propInfo.GetValue(propertyValue);
if (propertyValue == null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance>False</PackageRequireLicenseAcceptance>
<Version>2.1.0</Version>
<Version>2.1.1</Version>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
<FileVersion>2.1.0.0</FileVersion>
<Authors>Atsushi Nakamura</Authors>
Expand Down

0 comments on commit fc394f5

Please sign in to comment.