Reputation: 931
I'm trying to get the prop's from my WinPhone solutions in my xamarin froms project so that i can use them in my PCL.
So that in my App/PCL can do something like
App.WinPhone.Prop = 2; Or Var temp = App.WinPhone.Prop
thank for your time
Upvotes: 0
Views: 28
Reputation: 16199
You need to create a new class in your WP Native project. e.g.
[assembly: Dependency (typeof(MyProperties))]
namespace MyNamespace
{
public class MyProperties: IMyProperties
{
public string TheProperty { get { return "something"; } }
}
}
Create the appropriate interface in your PCL.
Then in your PCL do
DependencyService.Get<IMyProperties>().TheProperty
This webpage has more information: https://developer.xamarin.com/guides/xamarin-forms/dependency-service/introduction/
Upvotes: 0