Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Picker Custom Renderer - Resource is an ambiguous reference error

$
0
0

I have a custom renderer for a picker, too which I would like to add a down arrow

`
[assembly: ExportRenderer(typeof(CustomPicker), typeof(CustomPickerRenderer))]
namespace CustomRenderer.Android
{
class CustomPickerRenderer : PickerRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs e)
{
base.OnElementChanged(e);

        if (Control != null)
        {
            Control.SetBackgroundResource(Resource.Drawable.picker_icon);
        }
    }
}

}
`

My picker_icon.xml

<?xml version="1.0" encoding="UTF-8" ?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item> <layer-list> <item> <shape> <stroke android:width="1dp" android:color="@color/colorPrimary" /> <corners android:radius="5dp" /> <padding android:bottom="7dp" android:left="10dp" android:right="5dp" android:top="7dp" /> </shape> </item> <item> <bitmap android:gravity="right" android:src="@drawable/downarrow" /> </item> </layer-list> </item> </selector>

The custom renderer returns the following error when building
'Resource' is an ambiguous reference between MyProject.Droid.Resources' and 'Xamarin.Forms.Platform.Android.Resource'

Is this a namespace problem or is XAML Forms unable to access the Android drawables folder in C#?


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>