本文整理汇总了C#中Xamarin.Forms.ContentView类的典型用法代码示例。如果您正苦于以下问题:C# ContentView类的具体用法?C# ContentView怎么用?C# ContentView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ContentView类属于Xamarin.Forms命名空间,在下文中一共展示了ContentView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MenuPage2
public MenuPage2()
{
Icon = "MenuIcon.png";
Title = "menu";
BackgroundColor = Color.FromHex("333333");
Menu = new MenuListView();
var menuLabel = new ContentView
{
Padding = new Thickness(10, 36, 0, 5),
Content = new Label
{
TextColor = Color.FromHex("AAAAAA"),
Text = "MENU",
}
};
var layout = new StackLayout
{
Spacing = 0,
VerticalOptions = LayoutOptions.FillAndExpand
};
layout.Children.Add(menuLabel);
layout.Children.Add(Menu);
Content = layout;
}
示例2: AlertDetailsPage
public AlertDetailsPage(AlertNavigationPage alertManager)
{
// MAP MODULE
// Address
// Map
// TEXT MODULE
// Room -- Floor
// SEND MODULE
//Button
// Create Screen Elements
var button = new Button {
Text = "Send Test Alert",
TextColor = Color.White,
BackgroundColor = Color.Red,
HorizontalOptions = LayoutOptions.FillAndExpand,
MinimumHeightRequest = 100
};
button.Clicked += (sender, e) => {
alertManager.SendAlert ();
};
// Create Screen Content
Content = new ContentView {
Content = new StackLayout {
Children = {
button
}
}
};
}
示例3: RenderContent
private void RenderContent()
{
ScrollView scrollview = new ScrollView() { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand};
var rootLayout = new StackLayout() { BackgroundColor = Color.Black, Spacing = 15, Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness(0, 0, 0, 10) }; // Padding = new Thickness(45, 15, 45, 15),
ContentView header = new ContentView() { BackgroundColor = Color.Black, HorizontalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness(0, 80, 0, 0) };
rootLayout.Children.Add(header);
btnGoogleLogIn = new Button() {
Text = " LOG IN WITH GOOGLE ",
FontAttributes = FontAttributes.Bold,
BackgroundColor = Color.Green,
TextColor = Color.White,
HorizontalOptions = LayoutOptions.Center
};
rootLayout.Children.Add(btnGoogleLogIn);
scrollview.Content = rootLayout;
if (Device.OS == TargetPlatform.Android)
{
scrollview.IsClippedToBounds = true;
}
Content = scrollview;
}
示例4: PoliciesWebPage
public PoliciesWebPage()
{
// Set Page Title
Title = "Pace Policies";
var source = new UrlWebViewSource ();
source.Url = "http://pace.edu/sexual-assault";
var webView = new WebView {
HorizontalOptions = LayoutOptions.FillAndExpand,
VerticalOptions = LayoutOptions.FillAndExpand,
Source = source
};
webView.Navigating += (object sender, WebNavigatingEventArgs e) => {
System.Diagnostics.Debug.WriteLine("Loading");
};
webView.Navigated += (object sender, WebNavigatedEventArgs e) => {
System.Diagnostics.Debug.WriteLine("Done");
};
Content = new ContentView {
Content = new StackLayout {
Children = {
webView
}
}
};
}
示例5: TitleIXPage
public TitleIXPage()
{
// Set Page Title
Title = "Title IX Rights";
var source = new UrlWebViewSource ();
source.Url = "http://knowyourix.org/title-ix/title-ix-the-basics/";
var webView = new WebView {
HorizontalOptions = LayoutOptions.FillAndExpand,
VerticalOptions = LayoutOptions.FillAndExpand,
Source = source
};
webView.Navigating += (object sender, WebNavigatingEventArgs e) => {
System.Diagnostics.Debug.WriteLine("Loading");
};
webView.Navigated += (object sender, WebNavigatedEventArgs e) => {
System.Diagnostics.Debug.WriteLine("Done");
};
Content = new ContentView {
Content = new StackLayout {
Children = {
webView
}
}
};
}
示例6: MenuPage
public MenuPage()
{
Icon = "settings.png";
Title = "menu";
BackgroundColor = Color.FromHex ("#003f77");
Menu = new MenuListView ();
var menuLabel = new ContentView {
Padding = new Thickness (10, 15, 0, 15),
VerticalOptions = LayoutOptions.Center,
Content = new Label {
TextColor = Color.FromHex ("#ffffff"),
FontSize = 15,
Text = "Tristan Low \[email protected] ",
}
};
var layout = new StackLayout {
Spacing = 0,
VerticalOptions = LayoutOptions.FillAndExpand
};
layout.Children.Add (menuLabel);
layout.Children.Add (Menu);
Content = layout;
}
示例7: InitializeComponent
private void InitializeComponent() {
this.LoadFromXaml(typeof(StandingsView));
NameGrid = this.FindByName<Grid>("NameGrid");
MessagesLayoutFrame = this.FindByName<AbsoluteLayout>("MessagesLayoutFrame");
MessagesLayoutFrameInner = this.FindByName<ContentView>("MessagesLayoutFrameInner");
MessagesListView = this.FindByName<ListView>("MessagesListView");
}
示例8: AlertPage
public AlertPage()
{
// Set Page Navigation
Title = "Alert!";
alert = new Alert ();
// Create Screen Elements
var button = new Button {
Text = "Send Test Alert",
TextColor = Color.White,
BackgroundColor = Color.Red,
HorizontalOptions = LayoutOptions.FillAndExpand,
MinimumHeightRequest = 100
};
button.Clicked += (sender, e) => { fakeAlert(); };
// Create Screen Content
Content = new ContentView {
Content = new StackLayout {
Children = {
button
}
}
};
}
示例9: MenuPage
public MenuPage()
{
Icon = "profile_filler.png";//"settings.png";
Title = "menu"; // The Title property must be set.
BackgroundColor = Color.FromHex ("#007064");
Menu = new MenuListView ();
var menuLabel = new ContentView {
Padding = 10,
Content = new Label {
TextColor = Color.White,
Text = "Menu",
XAlign = TextAlignment.Center,
FontSize = 20,
FontAttributes = FontAttributes.Bold
}
};
StackLayout layout = new StackLayout {
VerticalOptions = LayoutOptions.FillAndExpand,
Orientation = StackOrientation.Vertical,
Spacing = 0
};
layout.Children.Add (menuLabel);
layout.Children.Add (Menu);
Content = layout;
}
示例10: MenuPage
public MenuPage()
{
Icon = "menu.png";
Title = "menu"; // The Title property must be set.
BackgroundColor = Color.FromHex("333333");
Menu = new MenuListView();
var menuLabel = new ContentView
{
Padding = new Thickness(10, 36, 0, 5),
Content = new Label
{
TextColor = Color.White, //Color.FromHex("AAAAAA"),
Text = StateService.GetInstance().AppName,
HorizontalOptions = LayoutOptions.Center
}
};
var layout = new StackLayout
{
Spacing = 0,
VerticalOptions = LayoutOptions.FillAndExpand
};
layout.Children.Add(menuLabel);
layout.Children.Add(Menu);
Content = layout;
}
示例11: BorderDisplayControl
public BorderDisplayControl() {
ContentView border = new ContentView();
border.BackgroundColor = Color.Green;
Content = border;
label = new Label();
border.Content = label;
}
示例12: LeadListHeaderView
public LeadListHeaderView(Command newLeadTappedCommand)
{
_NewLeadTappedCommand = newLeadTappedCommand;
#region title label
Label headerTitleLabel = new Label()
{
Text = TextResources.Leads_LeadListHeaderTitle.ToUpperInvariant(),
TextColor = Palette._003,
FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
FontAttributes = FontAttributes.Bold,
HorizontalTextAlignment = TextAlignment.Start,
VerticalTextAlignment = TextAlignment.Center
};
#endregion
#region new lead image "button"
var newLeadImage = new Image
{
Source = new FileImageSource { File = Device.OnPlatform("add_ios_gray", "add_android_gray", null) },
Aspect = Aspect.AspectFit,
HorizontalOptions = LayoutOptions.EndAndExpand,
};
//Going to use FAB
newLeadImage.IsVisible = false;
newLeadImage.GestureRecognizers.Add(new TapGestureRecognizer()
{
Command = _NewLeadTappedCommand,
NumberOfTapsRequired = 1
});
#endregion
#region absolutLayout
AbsoluteLayout absolutLayout = new AbsoluteLayout();
absolutLayout.Children.Add(
headerTitleLabel,
new Rectangle(0, .5, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize),
AbsoluteLayoutFlags.PositionProportional);
absolutLayout.Children.Add(
newLeadImage,
new Rectangle(1, .5, AbsoluteLayout.AutoSize, .5),
AbsoluteLayoutFlags.PositionProportional | AbsoluteLayoutFlags.HeightProportional);
#endregion
#region setup contentView
ContentView contentView = new ContentView()
{
Padding = new Thickness(10, 0), // give the content some padding on the left and right
HeightRequest = RowSizes.MediumRowHeightDouble, // set the height of the content view
};
#endregion
#region compose the view hierarchy
contentView.Content = absolutLayout;
#endregion
Content = contentView;
}
示例13: InitializeComponent
private void InitializeComponent()
{
this.LoadFromXaml(typeof(MatrixView));
grdRoot = this.FindByName<Grid>("grdRoot");
cnvInfo = this.FindByName<ContentView>("cnvInfo");
lblInfo = this.FindByName<Label>("lblInfo");
cnvHeader = this.FindByName<ContentView>("cnvHeader");
lblHeader1 = this.FindByName<Label>("lblHeader1");
lblHeaderContent1 = this.FindByName<Label>("lblHeaderContent1");
lblHeader2 = this.FindByName<Label>("lblHeader2");
lblHeaderContent2 = this.FindByName<Label>("lblHeaderContent2");
grdHeaderContent = this.FindByName<Grid>("grdHeaderContent");
lblZ = this.FindByName<Label>("lblZ");
lblZ1 = this.FindByName<Label>("lblZ1");
lblZ2 = this.FindByName<Label>("lblZ2");
lblZ3 = this.FindByName<Label>("lblZ3");
lblZ4 = this.FindByName<Label>("lblZ4");
lblZ5 = this.FindByName<Label>("lblZ5");
lblZ6 = this.FindByName<Label>("lblZ6");
lblD = this.FindByName<Label>("lblD");
lblD1 = this.FindByName<Label>("lblD1");
lblD2 = this.FindByName<Label>("lblD2");
lblD3 = this.FindByName<Label>("lblD3");
lblD4 = this.FindByName<Label>("lblD4");
lblD5 = this.FindByName<Label>("lblD5");
lblD6 = this.FindByName<Label>("lblD6");
stkChart = this.FindByName<StackLayout>("stkChart");
lblStatus = this.FindByName<Label>("lblStatus");
cnvMatrix = this.FindByName<ContentView>("cnvMatrix");
}
示例14: MenuPage
public MenuPage()
{
Icon = "settings.png";
Title = "menu"; // The Title property must be set.
Menu = new MenuListView ();
var menuLabel = new ContentView {
Padding = new Thickness (10, 36, 0, 5),
Content = new Label {
TextColor = Color.FromHex ("AAAAAA"),
Text = "MENU",
}
};
//this.Padding = new Thickness(10, Device.OnPlatform(50, 0, 0), 10, 5);
var layout = new StackLayout {
Spacing = 0,
VerticalOptions = LayoutOptions.FillAndExpand
};
layout.Children.Add (menuLabel);
layout.Children.Add (Menu);
Content = layout;
}
示例15: NewImagePage
public NewImagePage()
{
mImage = new Image
{
Source = "http://developer.xamarin.com/demo/IMG_1415.JPG?width=512"
};
tapPointsLayout = new AbsoluteLayout
{
VerticalOptions = LayoutOptions.Center,
HorizontalOptions = LayoutOptions.Center,
BackgroundColor = Color.Teal
};
tapPointsLayout.Children.Add(mImage);
imageContainer = new ContentView
{
Content = tapPointsLayout,
VerticalOptions = LayoutOptions.FillAndExpand,
BackgroundColor = Color.Yellow
};
imageContainer.SizeChanged += imageContainer_SizeChanged;
Content = new StackLayout
{
Children = {
new Label { Text = "Hello ContentPage" },
imageContainer,
new Label { Text = "PAUL IS COOL"}
}
};
//Content.SizeChanged += Content_SizeChanged;
}