Created
July 15, 2015 21:06
-
-
Save RedTahr/499a68b80d76a738dc5d to your computer and use it in GitHub Desktop.
Xamarin.Forms DerivedPage.xaml/cs from BasePage, Binding ViewModel in XAML.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8" ?> | |
<derived:BasePage xmlns="http://xamarin.com/schemas/2014/forms" | |
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | |
x:Class="....AboutPage" | |
xmlns:local="clr-namespace:...;assembly=..." | |
xmlns:derived="clr-namespace:....View;assembly=..." | |
BindingContext="{x:Static local:App.AboutViewModel}" | |
Title="About"> | |
<StackLayout Orientation="Vertical" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"> | |
<Label Text="{Binding Detail}"/> | |
<Label Text="{Binding TofS}"> | |
<Label.GestureRecognizers> | |
<TapGestureRecognizer Command="{Binding TofSCommand}" /> | |
</Label.GestureRecognizers> | |
</Label> | |
</Label> | |
</StackLayout> | |
</derived:BasePage> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace ... { | |
public partial class AboutPage : BasePage { | |
public AboutPage() { | |
InitializeComponent(); | |
((AboutViewModel)BindingContext).set(this); // AboutViewModel is public static in the App.cs for the XAML reference below. | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment