android - Sharing string resources between platforms in PCL project -
i creating xamarin multi-platform mobile project want use pcl shared project share parts of code.
i want share 1 strings files between platforms, same each of platforms.
i've created new .resx file in pcl project, dont know how can use values in android/ios projects. suggestions?
content of appresources.resx in pcl project:
<?xml version="1.0" encoding="utf-8"?> <root> <resheader name="resmimetype"> <value>text/microsoft-resx</value> </resheader> <resheader name="version"> <value>2.0</value> </resheader> <resheader name="reader"> <value>system.resources.resxresourcereader, system.windows.forms, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089</value> </resheader> <resheader name="writer"> <value>system.resources.resxresourcewriter, system.windows.forms, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089</value> </resheader> <data name="connectbutton" xml:space="preserve"> <value>connect</value> </data> <data name="ipaddress" xml:space="preserve"> <value>ip address</value> </data> </root>
you should able write:
var ipaddress = appresources.ipaddress;
or
var connectbutton = appresources.connectbutton;
you can find more information in documentation: http://developer.xamarin.com/guides/cross-platform/xamarin-forms/localization/
Comments
Post a Comment