public void InitContent(Xamarin.Forms.View content) { // build the loading page with native base content.Parent = Xamarin.Forms.Application.Current.MainPage; content.Layout(new Rectangle(0, 0, Xamarin.Forms.Application.Current.MainPage.Width, Xamarin.Forms.Application.Current.MainPage.Height)); var renderer = content.GetOrCreateRenderer(); _contentNativeView = renderer.View; _contentDialog = new Dialog(CrossCurrentActivity.Current.Activity); _contentDialog.RequestWindowFeature((int)WindowFeatures.NoTitle); _contentDialog.SetCancelable(true); _contentDialog.SetCanceledOnTouchOutside(true); _contentDialog.SetContentView(_contentNativeView); Window window = _contentDialog.Window; window.SetLayout(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); window.ClearFlags(WindowManagerFlags.DimBehind); window.SetBackgroundDrawable(new ColorDrawable(Android.Graphics.Color.Transparent)); _isContentInitialized = true; }
public IVisualElementRenderer Convert(Xamarin.Forms.View source, Xamarin.Forms.VisualElement valid) { IVisualElementRenderer render = source.GetOrCreateRenderer(); var properties = typeof(VisualElement).GetRuntimeProperties(); foreach (var item in properties) { if (item.Name == "IsPlatformEnabled") { item.SetValue(source, true); } } properties = typeof(Element).GetRuntimeProperties(); foreach (var item in properties) { if (item.Name == "Platform") { object value = item.GetValue(valid); item.SetValue(source, value); } } return(render); }
public CarouselViewHolder(Context context, DataTemplate template) : base(context) { context.InvokeOnMainThread(() => { _view = (View)template.CreateContent(); var renderer = _view.GetOrCreateRenderer(); _nativeView = renderer.ViewGroup; AddView(_nativeView); }); }
public void ToggleViewShadow(Xamarin.Forms.View view, bool isOn) { var renderer = view.GetOrCreateRenderer(); var nativeView = renderer.ViewGroup; var shadowWrapper = nativeView.Parent as ShadowWrapper; if (shadowWrapper != null) { //move back to original parent shadowWrapper.ResetParent(); view.SizeChanged -= OnSizeChanged; } if (isOn) { shadowWrapper = new ShadowWrapper(nativeView.Context, nativeView); view.SizeChanged += OnSizeChanged; } }
public void ShowContent(Xamarin.Forms.View content, bool mathParent = true) { // build the loading page with native base content.Parent = Xamarin.Forms.Application.Current.MainPage; if (mathParent) { content.Layout(new Rectangle(0, 0, Xamarin.Forms.Application.Current.MainPage.Width, Xamarin.Forms.Application.Current.MainPage.Height)); } else { content.Layout(new Rectangle(Xamarin.Forms.Application.Current.MainPage.Width - content.WidthRequest, Xamarin.Forms.Application.Current.MainPage.Height - content.HeightRequest, content.WidthRequest, content.HeightRequest)); } var renderer = content.GetOrCreateRenderer(); contentNativeView = renderer?.View; contentDialog = new Dialog(CrossCurrentActivity.Current.Activity); contentDialog.RequestWindowFeature((int)WindowFeatures.NoTitle); if (mathParent) { contentDialog.SetCanceledOnTouchOutside(false); contentDialog.SetOnKeyListener(new DialogInterfaceOnKeyListener()); } else { contentDialog.SetCanceledOnTouchOutside(true); } contentDialog.SetContentView(contentNativeView); Window window = contentDialog.Window; window.SetLayout(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); window.ClearFlags(WindowManagerFlags.DimBehind); window.SetBackgroundDrawable(new ColorDrawable(Android.Graphics.Color.Transparent)); // Show Popup contentDialog?.Show(); }