Issue
I have a hamburger icon which I will use it to navigate masterdetailpage.master part. I couldnt make sure how to write syntax under of the click event. Any ideas?
Solution
You could use the custom renderer to reset the hamburger icon of imagebutton.
[assembly: ExportRenderer(typeof(MainPage ), typeof(MasterDetailPageRenderer_Droid))]
namespace MasterDetailPageDemo.Droid
{
class MasterDetailPageRenderer_Droid:MasterDetailPageRenderer
{
public Android.Support.V7.Widget.Toolbar toolbar;
public Activity context;
public MasterDetailPageRenderer_Droid(Context context) : base(context)
{
}
protected override void OnLayout(bool changed, int l, int t, int r, int b)
{
base.OnLayout(changed, l, t, r, b);
context = (Activity)Forms.Context;
toolbar = context.FindViewById<Android.Support.V7.Widget.Toolbar>(Droid.Resource.Id.toolbar);
if (toolbar != null)
{
for (var i = 0; i < toolbar.ChildCount; i++)
{
var imageButton = toolbar.GetChildAt(i) as Android.Widget.ImageButton;
var drawerArrow = imageButton?.Drawable as DrawerArrowDrawable;
if (drawerArrow == null)
continue;
imageButton.SetImageDrawable(Forms.Context.GetDrawable(Resource.Drawable.star_small));
}
}
}
}
Answered By - Wendy Zang - MSFT
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.