When I try to set the background color of the Master (of the MasterDetailPage) to transparent, it stays white.
Basically what I would want to see, is that the color from the detail page is shown through the Master.
FOR EXAMPLE (If the above were true, then the background color of this MasterDetailPage would be red (Yes I know I can just set the background colour as red, but I want it to be transparent ))
After seeing the TabletMasterDetailRenderer's documentation , we can find that the master or detail page which we create in PCL will be added on the _masterController.View
and _detailController.View
.
So when we set its BackgroundColor
to Transparent
, the page will still be white as what we look. We should also set the _masterController.View
's BackgroundColor
.
We can find the _masterController
in renderer and set it like:
public override void ViewWillLayoutSubviews()
{
base.ViewWillLayoutSubviews();
var master = ViewControllers[0];
master.View.BackgroundColor = UIColor.Clear;
//This is Detail ViewController
var detail = ViewController.ChildViewControllers[1];
}
Create a custom renderer for MasterDetailPage
and put this code in it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.