Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
- using Xamarin.Forms;
- using Xamarin.Forms.Platform.WPF;
- namespace N2M_enwis.WPF
- {
- /// <summary>
- /// Interaction logic for MainWindow.xaml
- /// </summary>
- public partial class MainWindow : FormsApplicationPage
- {
- public class mrenderer : IVisualElementRenderer
- {
- public VisualElement Element => throw new NotImplementedException();
- public event EventHandler<VisualElementChangedEventArgs> ElementChanged;
- public void Dispose()
- {
- throw new NotImplementedException();
- }
- public SizeRequest GetDesiredSize(double widthConstraint, double heightConstraint)
- {
- throw new NotImplementedException();
- }
- System.Windows.Controls.Grid ng = null;
- public FrameworkElement GetNativeElement()
- {
- if (ng == null)
- ng = new System.Windows.Controls.Grid();
- ng.Width = ng.Height = 200;
- ng.Background = new SolidColorBrush(System.Windows.Media.Color.FromRgb(0, 0, 55));
- return ng;
- }
- public void SetElement(VisualElement element)
- {
- throw new NotImplementedException();
- }
- }
- public MainWindow()
- {
- StackLayout sl = new StackLayout();
- InitializeComponent();
- Forms.Init();
- var app = new N2M_enwis.App();
- LoadApplication(app);
- app.MainPage = new ContentPage();
- ((ContentPage)app.MainPage).Content = sl;
- app.MainPage.BackgroundColor = Xamarin.Forms.Color.Green;
- sl.WidthRequest = sl.HeightRequest = 1000;
- sl.BackgroundColor = Xamarin.Forms.Color.Yellow;
- var rnd = Xamarin.Forms.Platform.WPF.Platform.GetOrCreateRenderer(sl);
- Xamarin.Forms.Platform.WPF.FormsPanel ffelem = (Xamarin.Forms.Platform.WPF.FormsPanel)rnd.GetNativeElement();
- var newrend = new mrenderer();
- Xamarin.Forms.Platform.WPF.Platform.SetRenderer(sl, newrend);
- ffelem.Background = new SolidColorBrush(System.Windows.Media.Color.FromRgb(150,150,255));
- ffelem.Opacity = 0.5;
- var grid = new System.Windows.Controls.Grid();
- grid.Background = new SolidColorBrush(System.Windows.Media.Color.FromRgb(0, 0, 55));
- grid.Width = grid.Height = 200;
- ffelem.Children.Add(grid);
- grid.BringIntoView();
- ffelem.Children.Add(new System.Windows.Controls.Button());
- ffelem.Children.Add(new System.Windows.Controls.Button());
- ffelem.Children.Add(new System.Windows.Controls.Button());
- ffelem.Children.Add(new System.Windows.Controls.Button());
- ffelem.Children.Add(new System.Windows.Controls.Button());
- grid.Children.Add(new System.Windows.Controls.Button());
- grid.Children.Add(new System.Windows.Controls.Button());
- /*
- var btn = new System.Windows.Controls.Label();
- btn.Background = new SolidColorBrush(System.Windows.Media.Color.FromRgb(10, 10, 10));
- btn.MinWidth = 300;
- btn.MinHeight = 300;
- btn.Visibility = Visibility.Visible;
- btn.Content = "ztes";
- ffelem.Children.Add(btn);
- ffelem.UpdateLayout();*/
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement