嗨我有兩個Xamarin窗體中的按鈕,它必須改變它的風格,當一個被點擊時,其他不是。Xamarin按鈕樣式
我必須在圖像中給出需要。 選擇的應該是ITEM2,另一個應該是ITEM1。
如果我現在點擊ITEM1,它應該採用ITEM2的樣式,Item2應該採用ITEM1的樣式。
我使用XAMARIN形式的書面基本按鈕代碼,如下面給,
var Button1 = new Button
{
Text = "ITEM1",
Font = Font.SystemFontOfSize(14, FontAttributes.Bold),
BorderWidth = 1,
HorizontalOptions = LayoutOptions.CenterAndExpand,
VerticalOptions = LayoutOptions.CenterAndExpand
};
Button1.Clicked += OnButton1Clicked;
var Button2 = new Button
{
Text = "ITEM2",
Font = Font.SystemFontOfSize(14, FontAttributes.Bold),
BorderWidth = 1,
HorizontalOptions = LayoutOptions.CenterAndExpand,
VerticalOptions = LayoutOptions.CenterAndExpand
};
Button2.Clicked += OnButton2Clicked;
var tabHeader = new StackLayout
{
HeightRequest = 48,
//BackgroundColor = BrandingManager.LightGrey(),
Orientation = StackOrientation.Horizontal,
HorizontalOptions = LayoutOptions.StartAndExpand,
VerticalOptions = LayoutOptions.CenterAndExpand,
Children = { Button1, Button2},
Padding = new Thickness(10, 10, 10, 10)
};
你可以有一個被稱爲與不同的輸入參數來處理,對於你倆點擊事件功能。 – Milen 2014-09-30 07:37:20
感謝您的幫助。 – TBA 2014-09-30 12:35:26