xamarin.ios - How to assign Background Image to an entry in xamarin forms for ios -


i trying add background image entry in xamarin forms , wrote code rendering in ios , android. android working , ios not working. here sharing rendering code ios:

[assembly: exportrenderer (typeof(extendedusername), typeof(renderingentryuname))] namespace ifind.ios { public class renderingentryuname: entryrenderer {     // override onelementchanged method can tweak renderer post-initial setup     protected override void onelementchanged(elementchangedeventargs<entry> e)     {         base.onelementchanged(e);          if (control != null) {              control.textalignment=uitextalignment.center;             uiimage img=uiimage.fromfile("images/newimg.jpg");             control.background=img          }     }  } }              

by default uitextentry used forms entry have border style set uitextborderstyle.roundedrect , background ignored.

set border style none , image show up:

if (control != null) {    control.borderstyle = uitextborderstyle.none;    control.textalignment=uitextalignment.center;    uiimage img=uiimage.fromfile("images/newimg.jpg");    control.background=img } 

if value set uitextborderstyleroundedrect style, custom background image associated text field ignored.

ref: uitextfield


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -