|
|
|
@ -0,0 +1,39 @@ |
|
|
|
|
using System; |
|
|
|
|
using System.Collections.Generic; |
|
|
|
|
using System.Linq; |
|
|
|
|
using System.Text; |
|
|
|
|
|
|
|
|
|
using Xamarin.Forms; |
|
|
|
|
|
|
|
|
|
namespace XamarinStudy.Views |
|
|
|
|
{ |
|
|
|
|
public class SampleElementPage2 : ContentPage |
|
|
|
|
{ |
|
|
|
|
public SampleElementPage2() |
|
|
|
|
{ |
|
|
|
|
BackgroundColor = Color.White; |
|
|
|
|
|
|
|
|
|
Button changeBackgroundColorButton = new Button() { Text = "Change background color", BackgroundColor = Color.DarkViolet, FontSize = 30 }; |
|
|
|
|
changeBackgroundColorButton.Clicked += ChangeBackgroundColorButton_Clicked; |
|
|
|
|
Label label1 = new Label() { Text = "CS Label", TextColor = Color.Red, BackgroundColor = Color.DeepSkyBlue, FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)) }; |
|
|
|
|
Label label2 = new Label() { Text = "CS 20 Label", TextColor = Color.Red, BackgroundColor = Color.DeepSkyBlue, FontSize = 30 }; |
|
|
|
|
Content = new StackLayout |
|
|
|
|
{ |
|
|
|
|
Children = |
|
|
|
|
{ |
|
|
|
|
changeBackgroundColorButton, |
|
|
|
|
label1, |
|
|
|
|
label2 |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void ChangeBackgroundColorButton_Clicked(object sender, EventArgs e) |
|
|
|
|
{ |
|
|
|
|
if (BackgroundColor == Color.White) |
|
|
|
|
BackgroundColor = Color.DarkSlateGray; |
|
|
|
|
else |
|
|
|
|
BackgroundColor = Color.White; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |