//LabelButton.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace App1.Controls
{
//[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class LabelButton : Button
{
//Bindable属性,类似WPF的依赖属性,属性名需要符合常规属性名+Property的格式
public static readonly BindableProperty MyLabelProperty = BindableProperty.Create(nameof(MyLabel), typeof(Label), typeof(LabelButton));
public Label MyLabel
{
get { return (Label)GetValue(MyLabelProperty); }
set { SetValue(MyLabelProperty, value); }
}
public LabelButton()
{
InitializeComponent();
}
}
}