Reputation: 1309
while trying to code the TipCalc example in MvvmCross, i try to use x:Bind instead of the regular Binding (In universal application programming)
my code behind looks like this:
public sealed partial class TipView
{
public new TipViewModel ViewModel
{
get { return (TipViewModel)base.ViewModel; }
set { base.ViewModel = value; }
}
public TipView()
{
this.InitializeComponent();
}
}
and my xaml looks like this:
<Grid x:Name="ContentPanel"
Margin="12,0,12,0"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
>
<StackPanel>
<TextBlock
Text="SubTotal"
/>
<TextBox
Text="{x:Bind ViewModel.SubTotal, Mode=TwoWay}"
/>
.
.
.
when compiling this i get the following error:
Microsoft.Windows.UI.Xaml.Common.targets(350,5): Xaml Internal Error error WMC9999: Unable to cast object of type 'Microsoft.MetadataReader.MetadataOnlyPropertyInfo' to type 'System.Reflection.MethodInfo'.
i'm using the MvvmCross libs of 3.5.1 version (last stable)
is it a bug ? or something i am missing here ?
Upvotes: 1
Views: 981
Reputation: 6142
I use following syntax in my code
public TipViewModel Vm => (TipViewModel) ViewModel;
And the binding would be
Text="{x:Bind Vm.SubTotal, Mode=TwoWay}"
Not sure why you would get your error, your view does inherit from MvxWindowsPage
?
Upvotes: 4