本文整理汇总了C#中Xamarin.Forms.Thickness类的典型用法代码示例。如果您正苦于以下问题:C# Thickness类的具体用法?C# Thickness怎么用?C# Thickness使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Thickness类属于Xamarin.Forms命名空间,在下文中一共展示了Thickness类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CoursePageDB
public CoursePageDB()
{
Padding = new Thickness(10, Device.OnPlatform(20,0,0),10,0);
BackgroundColor = Color.Gray;
//this.Title = course.TitleShort;
this.SetBinding(ContentPage.TitleProperty, "TitleShort");
var titleLabel = new Label() {/*Text = course.Title,*/ Font = Font.SystemFontOfSize(NamedSize.Large)};
titleLabel.SetBinding(Label.TextProperty,"Title");
var authorLabel = new Label() {/*Text = course.Author,*/ Font = Font.SystemFontOfSize(NamedSize.Small)};
authorLabel.SetBinding(Label.TextProperty,"Author");
var descriptionLabel = new Label() {/*Text = course.Description,*/ Font = Font.SystemFontOfSize(NamedSize.Medium)};
descriptionLabel.SetBinding(Label.TextProperty, "Description");
Content = new ScrollView()
{
Content = new StackLayout()
{
Spacing = 10,
Children = { titleLabel,authorLabel,descriptionLabel}
}
};
}
示例2: LabelledSectionPage
public LabelledSectionPage()
{
Padding = new Thickness (0, 20, 0, 0);
var list = new ListView
{
ItemTemplate = new DataTemplate(typeof(TextCell))
{
Bindings = {
{ TextCell.TextProperty, new Binding ("Name") }
}
},
GroupDisplayBinding = new Binding("LongTitle"),
GroupShortNameBinding = new Binding("Title"),
Header = "HEADER",
Footer = "FOOTER",
IsGroupingEnabled = true,
ItemsSource = SetupList(),
};
list.ItemTapped += (sender, e) =>
{
var listItem = (ListItemValue)e.Item;
DisplayAlert(listItem.Name, "You tapped " + listItem.Name, "OK", "Cancel");
};
Content = new StackLayout
{
VerticalOptions = LayoutOptions.FillAndExpand,
Children = { list }
};
}
示例3: FacebookLoginPage
public FacebookLoginPage(FacebookConnection connection)
{
this.Title = "FacebookLoginPage";
// Connection = new FacebookConnection(key, secret, scope);
// connection.SignInCompleted += Connection_SignInCompleted;
this._Connection = connection;
this._Browser = new WebView();
//_Browser.Source = new UrlWebViewSource() { Url = _Connection.LoginUri().AbsoluteUri };
this._Connection.SignIn(this._Browser);
Label lbl = new Label ()
{ Text = "Connecting..." };
lbl.SetBinding(Label.IsVisibleProperty, "IsVisible", BindingMode.OneWay, new BooleanInverterConverter());
lbl.BindingContext = this._Browser;
this._BaseLayout = new StackLayout()
{
Orientation = StackOrientation.Vertical,
HorizontalOptions = LayoutOptions.FillAndExpand,
VerticalOptions = LayoutOptions.FillAndExpand,
};
this._BaseLayout.Children.Add(lbl);
this._BaseLayout.Children.Add(this._Browser);
this._Browser.IsVisible = false;
Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0); // Accomodate iPhone status bar.
Content = this._BaseLayout;
}
示例4: Page2
public Page2()
{
var label = new Label { Text = "Hello ContentPage 2" };
Device.OnPlatform(
iOS: () => {
var parentTabbedPage = this.ParentTabbedPage() as MainTabbedPage;
if (parentTabbedPage != null) {
// HACK: get content out from under status bar if a navigation bar isn't doing that for us already.
Padding = new Thickness(Padding.Left, Padding.Top + 25f, Padding.Right, Padding.Bottom);
}
}
);
var button = new Button() {
Text = "Switch to Tab 1; add a Page 2 there",
};
button.Clicked += async (sender, e) => {
var tabbedPage = this.ParentTabbedPage() as MainTabbedPage;
var partPage = new Page2() { Title = "Added page 2" };
await tabbedPage.SwitchToTab1(partPage, resetToRootFirst: false);
};
Content = new StackLayout {
Children = {
button,
label,
}
};
}
示例5: InitializeComponent
/// <summary>
/// Initializes the component.
/// </summary>
void InitializeComponent()
{
var layout = new StackLayout
{
VerticalOptions = LayoutOptions.Center
};
var label = new Label
{
Text = "T-Shirt shop",
FontSize = 36.0,
TextColor = Color.FromRgb(52, 152, 219),
HorizontalOptions = LayoutOptions.Center
};
var tableView = new TableView
{
Intent = TableIntent.Menu,
Root = new TableRoot
{
GetTableSection("C# T-Shirt", MockData.GetCsharp()),
GetTableSection("F# T-Shirt", MockData.GetFsharp())
}
};
layout.Children.Add(label);
layout.Children.Add(tableView);
Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5);
Content = layout;
}
示例6: SportsCategoryPage
public SportsCategoryPage ()
{
Title = "Sports";
Padding = new Thickness (10, 20);
var places = new List<Place> ()
{
new Place("The Gulf Bowl", "gulfBowl.jpg", "2881 S Juniper St, Foley, AL"),
new Place("Foley Sports Complex", "foleySportsComplex.jpg", "998 W Section Ave, Foley, AL"),
new Place("Swatters Sports Complex", "swattersSportsComplex.jpg", "21431 Co Rd 12 S Foley, AL")
};
var imageTemplate = new DataTemplate (typeof(ImageCell));
imageTemplate.SetBinding (ImageCell.TextProperty, "Name");
imageTemplate.SetBinding (ImageCell.ImageSourceProperty, "Icon");
imageTemplate.SetBinding (ImageCell.DetailProperty, "Address");
var listView = new ListView ()
{
ItemsSource = places,
ItemTemplate = imageTemplate
};
Content = listView;
}
示例7: MarginFrame
public MarginFrame(int marginLeft, int marginTop, int marginRight, int marginBottom, Color backgroundColor)
{
Padding = new Thickness(marginLeft, marginTop, marginRight, marginBottom);
OutlineColor = backgroundColor;
BackgroundColor = backgroundColor;
HasShadow = false;
}
示例8: HomePageOLD
public HomePageOLD()
{
Padding = new Thickness (5, Device.OnPlatform (20, 0, 0), 5, 5);
Title = "ITDevConnections Demo1";
var greetingLabel = new Label {
Text = "Welcome to this Proof of Concept for IT Dev Connections 2015, " +
"SQL Azure, Azure Mobile Services and Xamarin Crosss Platform Mobile Development",
Font = Font.SystemFontOfSize(NamedSize.Small)
};
var CustomersButton = new Button {
Text = "Load Customers"
};
var OrdersButton = new Button {
Text = "Show Orders"
};
CustomersButton.Clicked += (sender, e) => {
Navigation.PushAsync(new DisplayCustomrPageOLD());
};
OrdersButton.Clicked += (sender, e) => {
Navigation.PushAsync(new DisplayOrderPageOld());
};
Content = new StackLayout {
Children = {
greetingLabel,
CustomersButton,
OrdersButton
}
};
}
示例9: AboutPage
public AboutPage()
{
Title = "About";
Content = new StackLayout
{
Children =
{
new Label
{
FontSize = 24,
Text = "C# Sample: MvvM Basics\n\n" +
"Basic Model View ViewModel functionality:\n\n" +
"* Binding a View (page) to a ViewModel, two-way binding, View -updates-> ViewModel, ViewModel -update-> View\n\n" +
"* MvvMCross Framework locates ViewModel for View via naming convention, loads and binds them\n\n" +
"* Navigation to View via MvvMCros IoC container, all you need is the view Type\n\n" +
"* Buttons etc. use the ICommand pattern; this interface has a 'CanExecute' property the can enable / disable the button\n" +
" via standard property binding to visual element properties; and an Execute function called when the button is clicked\n\n" +
"* MvvMCross.Forms same App simulteanously targeting multiple supported platforms.\n"
}
}
};
if (Device.OS == TargetPlatform.Windows)
Padding = new Xamarin.Forms.Thickness(this.Padding.Left, this.Padding.Top, this.Padding.Right, 95);
}
示例10: ListPreviousContact
public ListPreviousContact(Opdracht opdracht,String CompanyName)
{
Title = CompanyName;
Padding = new Thickness(10, 10, 10, 10);
BackgroundColor = Color.White;
layout = new StackLayout();
lstvPreviousContact = new ListView
{
HasUnevenRows = true,
ItemTemplate = new DataTemplate(typeof(PreviousCell)),
ItemsSource = PreviousData.GetData(opdracht),
SeparatorColor = Color.FromHex("ddd"),
BackgroundColor = Color.White,
};
lstvPreviousContact.ItemSelected += (sender, e) => {
if (e.SelectedItem != null){
Previous pre = e.SelectedItem as Previous;
List<Opdracht> lijstopdracht = DataController.Instance.GetAssessmentsByID(pre.OpdrachtID);
Navigation.PushAsync(new AssessmentDetailPage(lijstopdracht[0]));
}
((ListView)sender).SelectedItem = null;
};
layout.Children.Add(lstvPreviousContact);
}
示例11: GridPage5
public GridPage5 ()
{
Padding = new Thickness (0, Device.OnPlatform (20, 0, 0), 0, 0);
var grid = new Grid ();
grid.Children.Add (
new Image() {
Source= Device.OnPlatform("[email protected]", "icon.png", "")
}, 0, 0);
grid.Children.Add (new Label () { Text = "40", BackgroundColor = Color.Yellow}, 0, 1);
grid.Children.Add (new Label () { Text = "Remainder", BackgroundColor = Color.Pink}, 0, 2);
grid.RowDefinitions.Add (new RowDefinition ()
{
Height = new GridLength(1, GridUnitType.Auto)
});
grid.RowDefinitions.Add (new RowDefinition ()
{
Height = new GridLength(40, GridUnitType.Absolute)
});
grid.RowDefinitions.Add (new RowDefinition ()
{
Height = new GridLength(1, GridUnitType.Star)
});
Content = grid;
}
示例12: StackLayoutExample2
public StackLayoutExample2()
{
Padding = new Thickness(20);
Label red = new Label
{
Text = "Stop",
BackgroundColor = Color.Red,
FontSize = 20
};
Label yellow = new Label
{
Text = "Slow down",
BackgroundColor = Color.Yellow,
FontSize = 20
};
Label green = new Label
{
Text = "Go",
BackgroundColor = Color.Green,
FontSize = 20
};
Content = new StackLayout
{
Spacing = 10,
VerticalOptions = LayoutOptions.End,
Orientation = StackOrientation.Horizontal,
HorizontalOptions = LayoutOptions.Start,
Children = { red, yellow, green }
};
}
示例13: SystemOffsetPage
public SystemOffsetPage()
{
var bc = new VM();
BindingContext = bc;
InitializeComponent();
Device.StartTimer(TimeSpan.FromMilliseconds(2000), () =>
{
bc.Padding = new Thickness(10,10,10,10);
return false;
});
Device.StartTimer(TimeSpan.FromMilliseconds(4000), () =>
{
bc.IsSystemPadding = false;
return false;
});
Device.StartTimer(TimeSpan.FromMilliseconds(6000), () =>
{
Padding = new Thickness();
return false;
});
Device.StartTimer(TimeSpan.FromMilliseconds(8000), () =>
{
HasSystemPadding = true;
return false;
});
}
示例14: TitleBarView
public TitleBarView()
{
//Spacing = 0;
//Padding=new Thickness(10,0);
Padding = new Thickness(10, 10);
BackgroundColor = Color.White; //Color.FromHex("#f7f7f7");
Orientation = StackOrientation.Vertical;
textLabel = new Label();
textLabel.BindingContext = this;
lineView = new LineView()
{
HorizontalOptions = LayoutOptions.FillAndExpand
};
lineView.BindingContext = this;
textLabel.SetBinding(Label.TextProperty,"Text");
textLabel.SetBinding(Label.TextColorProperty, "TextColor");
textLabel.SetBinding(Label.FontAttributesProperty, "FontAttributes");
textLabel.SetBinding(Label.FontFamilyProperty, "FontFamily");
textLabel.SetBinding(Label.FontSizeProperty, "FontSize");
//lineView.SetBinding(LineView.BackgroundColorProperty, "UnderLineColor");
lineView.BackgroundColor = Color.FromHex("#eee");
lineView.SetBinding(LineView.HeightRequestProperty, "UnderLineHeight");
Children.Add(textLabel);
Children.Add(lineView);
}
示例15: MenuPage
public MenuPage ()
{
Title = "Menu";
Icon = "menu.png";
Padding = new Thickness (10, 20);
var categories = new List<Category> () {
new Category("Food", () => new FoodCategoryPage()),
new Category("Shopping", () => new ShoppingCategoryPage()),
new Category("Sports", () => new SportsCategoryPage())
};
var dataTemplate = new DataTemplate (typeof(TextCell));
dataTemplate.SetBinding (TextCell.TextProperty, "Name");
var listView = new ListView () {
ItemsSource = categories,
ItemTemplate = dataTemplate
};
listView.ItemSelected += (object sender, SelectedItemChangedEventArgs e) => {
if (OnMenuSelect != null)
{
var category = (Category) e.SelectedItem;
var categoryPage = category.PageFn();
OnMenuSelect(categoryPage);
}
};
Content = listView;
}