XF 按钮控件

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:App19"
             x:Class="App19.MainPage">
    <StackLayout VerticalOptions="Center">
    <Button BorderColor="Black" Text="点击我" BorderWidth="2" BorderRadius="10" Clicked="Button_Clicked"></Button>
    </StackLayout>

</ContentPage>

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;

namespace App19
{
    public partial class MainPage : ContentPage
    {
        public MainPage()
        {
            InitializeComponent();
        }

        private void Button_Clicked(object sender, EventArgs e)
        {
            ((Button)sender).BackgroundColor = Color.Red;
        }
    }
}
 

posted @ 2018-08-06 21:40  dxm809  阅读(59)  评论(0编辑  收藏  举报