I am trying to add some ApplicationResources
to my Xamarin
application that uses MvvmCross
I currently have an App.cs file like so:
public class App : MvxApplication
{
/// <summary>
/// Initializes this instance.
/// </summary>
public override void Initialize()
{
this.CreatableTypes()
.EndingWith("Service")
.AsInterfaces()
.RegisterAsLazySingleton();
.....etc etc..
}
}
I am now following Working with Styles using Xaml for your application and have got:
<?xml version="1.0" encoding="utf-8" ?>
<Application xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:mvvmcross="clr-namespace:Cirrious.MvvmCross.ViewModels;assembly=Cirrious.MvvmCross"
x:Class="FieldStrikeMove.Core.App">
<Application.Resources>
<ResourceDictionary>
<Style x:Key="TestStyle" TargetType="Label">
<Setter Property="TextColor" Value="Green" />
</Style>
</ResourceDictionary>
</Application.Resources>
</Application >
I also added the partial keyword to my App.cs class, but this says:
Partial declarations of must not specify different base classes
So i tried
<?xml version="1.0" encoding="utf-8" ?>
<mvvmcross:MvxApplication xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:mvvmcross="clr-namespace:Cirrious.MvvmCross.ViewModels;assembly=Cirrious.MvvmCross"
x:Class="FieldStrikeMove.Core.App">
<Application.Resources>
<ResourceDictionary>
<Style x:Key="TestStyle" TargetType="Label">
<Setter Property="TextColor" Value="Green" />
</Style>
</ResourceDictionary>
</Application.Resources>
</mvvmcross:MvxApplication>
but I get:
Error 35 The type 'FieldStrikeMove.Core.App' cannot be used as type parameter 'TView' in the generic type or method 'Xamarin.Forms.Xaml.Extensions.LoadFromXaml(TView, System.Type)'. There is no implicit reference conversion from 'FieldStrikeMove.Core.App' to 'Xamarin.Forms.BindableObject'.
Is there a way to have Xaml application resources with a MvvmCross Xamarin application