• XF相对控件布局


    using System;
    using Xamarin.Forms;
    using Xamarin.Forms.Xaml;

    [assembly: XamlCompilation (XamlCompilationOptions.Compile)]
    namespace App6
    {
        public partial class App : Application
        {
            public App ()
            {
                InitializeComponent();
                BoxView bv = new BoxView { Color = Color.Red, WidthRequest = 150, HeightRequest = 150 };
                Label lbl = new Label { Text = "这是一个红色的方块", TextColor = Color.Red };
                RelativeLayout rl = new RelativeLayout();
                rl.Children.Add(bv,Constraint.RelativeToParent((parent)=>parent.Width/2),Constraint.RelativeToParent((parent)=>parent.Height/2));
                rl.Children.Add(lbl, Constraint.RelativeToView(bv, (parent, sibling) => sibling.X+bv.Width), Constraint.RelativeToView(bv, (parent, sibling) => sibling.Y));
                

                MainPage = new ContentPage { Content=rl};
            }

            protected override void OnStart ()
            {
                // Handle when your app starts
            }

            protected override void OnSleep ()
            {
                // Handle when your app sleeps
            }

            protected override void OnResume ()
            {
                // Handle when your app resumes
            }
        }
    }
     

  • 相关阅读:
    微信小程序退款【证书的使用】
    生成随机位数的UUID
    弹出层-layui
    load加载层-layui
    form-layui
    table-layui
    下拉列表模仿placeholder效果
    .net core 2.0 Unable to convert MySQL date/time to System.DateTime
    .net core Include问题
    .net core 2.0 配置Session
  • 原文地址:https://www.cnblogs.com/dxmfans/p/9434591.html
Copyright © 2020-2023  润新知