Hi,
Render.Model.Width or Height always returning -1, How can I get Width or Height in Native project:
`
public class MyNavigationRenderer : Xamarin.Forms.Platform.iOS.NavigationRenderer {
public void ShowDialog(Xamarin.Forms.View view) {
using (var renderer = Xamarin.Forms.Platform.iOS.RendererFactory.GetRenderer(view)) {
var popup = renderer.NativeView;
UIButton background = new UIButton();
this.View.Window.RootViewController.View.AddSubview(background);
this.View.Window.RootViewController.View.AddSubview(popup);
background.BackgroundColor = UIColor.Black;
popup.SizeToFit();
background.SizeToFit();
background.TitleLabel.Text = "";
popup.Alpha = 0;
popup.Frame = new RectangleF(new PointF(100, 100), new SizeF(1, 1));
background.Alpha = 0.6f;
background.Frame = background.Window.Frame;
UIButton.Animate(0.4, () => {
popup.Alpha = 1;
//*****************************************************
// renderer.Model.Width returning -1
popup.Frame = new System.Drawing.RectangleF(0, 0, Convert.ToSingle(renderer.Model.Width), Convert.ToSingle(renderer.Model.Height));
popup.Center = background.Window.Center;
});
background.TouchUpInside += (object sender, EventArgs e) => {
UIButton.Animate(.3, () => {
popup.Alpha = 0;
popup.Frame = new RectangleF(new PointF(100, 100), new SizeF(1, 1));
background.Alpha = 0;
}, () => {
background.RemoveFromSuperview();
popup.RemoveFromSuperview();
});
};
}
}
`
And this is my code in PCL Project:
`
var p2 = new StackLayout {
BackgroundColor = Color.Red, WidthRequest = 200, HeightRequest = 200,
Children = { new Button(){ Text = "Hello" }
}
};
Parent.ShowDialog(p2);
`
Thanks.