Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

How do I Set the Icon for the MasterDetailPage Master Icon using a drawable?

$
0
0

How do I SetIcon for the MasterDetailPage Master Icon? The following code will only update the actionBar Icon Drawable.

The MasterDetailPage.Master.Icon attribute only accepts a FileImageSource and I'm creating a drawable from a Font (*.tff file).

 public class MyMasterDetailRenderer : MasterDetailRenderer
    {
        protected override void OnAttachedToWindow()
        {
            base.OnAttachedToWindow();            
            var actionBar = ((Activity)this.Context)?.ActionBar;
            if (actionBar != null)
            {

                var fontDrawable = new FontDrawable(this.Context, StyleKit.SpinIcon, Color.White.ToAndroid(), 32);               
                actionBar.SetIcon(fontDrawable);
            }
        }
    }

Viewing all articles
Browse latest Browse all 91519

Trending Articles



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