本文整理汇总了C#中Xamarin.Forms.ScrollView类的典型用法代码示例。如果您正苦于以下问题:C# ScrollView类的具体用法?C# ScrollView怎么用?C# ScrollView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ScrollView类属于Xamarin.Forms命名空间,在下文中一共展示了ScrollView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ValidateNumberPage
public ValidateNumberPage()
{
cursorLabel = new LabelCustomFont {
Text = ">"
};
entryNumber = new EntryCustomFont {
HorizontalOptions = LayoutOptions.FillAndExpand,
Keyboard = Keyboard.Numeric
};
entryNumber.Completed += OnNumberEntryCompleted;
stackLayout = new StackLayout {
Padding = new Thickness(16),
Children = {
new LabelCustomFont {
Text = "ENTER A CREDIT CARD NUMBER:"
},
new StackLayout {
Children = {
cursorLabel, entryNumber
},
Orientation = StackOrientation.Horizontal,
Spacing = 0
}
}
};
Content = new ScrollView() {
Content = stackLayout,
HorizontalOptions = LayoutOptions.FillAndExpand,
Orientation = ScrollOrientation.Vertical
};
}
示例2: ProjectsPage
public ProjectsPage()
{
ProjectsViewModel projectsVM = new ProjectsViewModel();
var layout = new StackLayout
{
Spacing = 0,
VerticalOptions = LayoutOptions.FillAndExpand
};
foreach (Project project in projectsVM.Projects)
{
layout.Children.Add(new Label
{
Text = project.title
});
layout.Children.Add(new Label
{
Text = project.description
});
layout.Children.Add(new Label
{
Text = $"Type: {project.type}"
});
}
Content = new ScrollView
{
Content = layout
};
}
示例3: MainPage
public MainPage()
{
Label theLabel = new Label() {
Text = " click ",
HorizontalOptions = LayoutOptions.CenterAndExpand,
VerticalOptions = LayoutOptions.CenterAndExpand
};
Button theButton = new Button() {
Text = "Click Me",
HorizontalOptions = LayoutOptions.CenterAndExpand,
VerticalOptions = LayoutOptions.CenterAndExpand
};
theButton.Clicked +=(sender, e) => {
theLabel.Text = string.Format("{0} {1}"," click ",theLabel.Text);
};
DatePicker dtPicket = new DatePicker();
var container = new StackLayout() {
Padding = new Thickness(20, Device.OnPlatform(20,0,0),20,20)
};
container.Children.Add(dtPicket);
container.Children.Add(theButton);
container.Children.Add(theLabel);
Content = new ScrollView() { Content = container };
}
示例4: AbsoluteLayoutPageCode
public AbsoluteLayoutPageCode ()
{
Title = "AbsoluteLayout - C#";
BackgroundImage = "deer.jpg";
var outerLayout = new AbsoluteLayout ();
var scroll = new ScrollView ();
outerLayout.Children.Add (scroll, new Rectangle (0, 0, 1, 1), AbsoluteLayoutFlags.All);
outerLayout.Children.Add (new Button {
Text = "Previous",
BackgroundColor = Color.White,
TextColor = Color.Green,
BorderRadius = 0
}, new Rectangle (0, 1, .5, 60), AbsoluteLayoutFlags.PositionProportional | AbsoluteLayoutFlags.WidthProportional);
outerLayout.Children.Add (new Button {
Text = "Next",
BackgroundColor = Color.White,
TextColor = Color.Green,
BorderRadius = 0
}, new Rectangle (1, 1, .5, 60), AbsoluteLayoutFlags.PositionProportional | AbsoluteLayoutFlags.WidthProportional);
var innerLayout = new AbsoluteLayout ();
scroll.Content = innerLayout;
innerLayout.Children.Add (new Image { Source = "deer.jpg" }, new Rectangle (.5, 0, 300, 300), AbsoluteLayoutFlags.PositionProportional);
innerLayout.Children.Add (new BoxView { Color = Color.FromHex ("#CC1A7019") }, new Rectangle (.5, 300, .7, 50), AbsoluteLayoutFlags.XProportional | AbsoluteLayoutFlags.WidthProportional);
innerLayout.Children.Add (new Label { Text = "deer.jpg", XAlign = TextAlignment.Center, TextColor = Color.White }, new Rectangle (.5, 310, 1, 50), AbsoluteLayoutFlags.XProportional | AbsoluteLayoutFlags.WidthProportional);
Content = outerLayout;
}
示例5: SlideShowView
public SlideShowView ()
{
HeightRequest = 200;
var image1 = new Image() {Source = new FileImageSource(){ File = "bama1.jpg"}};
var image2 = new Image() {Source = new FileImageSource(){ File = "bama2.jpg"}};
var image3 = new Image() {Source = new FileImageSource(){ File = "bama3.jpg"}};
var image4 = new Image() {Source = new FileImageSource(){ File = "bama4.jpg"}};
var image5 = new Image() {Source = new FileImageSource(){ File = "bama5.jpg"}};
var image6 = new Image() {Source = new FileImageSource(){ File = "bama6.jpg"}};
var image7 = new Image() {Source = new FileImageSource(){ File = "bama7.jpg"}};
var image8 = new Image() {Source = new FileImageSource(){ File = "bama8.jpg"}};
var image9 = new Image() {Source = new FileImageSource(){ File = "bama9.jpg"}};
var stack = new StackLayout () {
Padding = new Thickness(0,0,0,10),
Orientation = StackOrientation.Horizontal,
Spacing = 10,
Children = {
image1,
image2,
image3,
image4,
image5,
image6,
image7,
image8,
image9
}
};
Content = new ScrollView() {
Content = stack,
Orientation = ScrollOrientation.Horizontal};
}
示例6: MovieDetail
public MovieDetail(string title, string rate, string poster, string descritption)
{
Title =title;
Label rating = new Label {
Text = rate,
FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
HorizontalOptions = LayoutOptions.Center
};
Image image = new Image{
Source=poster,
HeightRequest = 350,
WidthRequest = 125
};
Label description = new Label {
Text = descritption,
FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
HorizontalOptions = LayoutOptions.CenterAndExpand,
};
StackLayout stackLayout = new StackLayout {
Children = {rating, image, description}
};
ScrollView scroll = new ScrollView{
Content = stackLayout
};
this.Content = scroll;
}
示例7: 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}
}
};
}
示例8: HomePage
public HomePage(string username)
: base("HomePage")
{
_mainScroll = new ScrollView {
HorizontalOptions = LayoutOptions.FillAndExpand,
VerticalOptions = LayoutOptions.FillAndExpand
};
this.Content = _mainScroll;
_mainStack = new StackLayout{
HorizontalOptions = LayoutOptions.FillAndExpand,
VerticalOptions = LayoutOptions.FillAndExpand
};
_mainScroll.Content = _mainStack;
_homepageTitle = new Label {
Text = "Welcome, " + username + "!",
HorizontalOptions = LayoutOptions.CenterAndExpand
};
_mainStack.Children.Add (_homepageTitle);
_next = new Views.TrackingButton(this.Title) {
Text = "Next",
HorizontalOptions = LayoutOptions.CenterAndExpand
};
_next.Clicked += Next_Clicked;
_mainStack.Children.Add (_next);
}
示例9: CallPutPage
public CallPutPage ()
{
BackgroundColor = MyColors.MidnightBlue;
var stackLayout = new StackLayout {
Padding = new Thickness (15),
Children = {
new Label {
Text = "Compare call/put price against $100",
HorizontalOptions = LayoutOptions.CenterAndExpand,
FontAttributes = FontAttributes.Bold,
TextColor = MyColors.Clouds
},
new BoxView{ HeightRequest = 10, Opacity = 0 },
callValueEntry,
new BoxView{ HeightRequest = 10, Opacity = 0 },
putValueEntry,
new BoxView{ HeightRequest = 10, Opacity = 0 },
calcuatePayoffButton,
}
};
var scrollView = new ScrollView ();
scrollView.Content = stackLayout;
Content = scrollView;
calcuatePayoffButton.Clicked += CalcuatePayoffButton_Clicked;
}
示例10: LoginPage
public LoginPage()
{
BindingContext = new LoginViewModel(Navigation);
var layout = new StackLayout { Padding = 10 };
var label = new Label
{
Text = "Login",
FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
TextColor = Color.White,
VerticalOptions = LayoutOptions.Start,
HorizontalTextAlignment = TextAlignment.Center,
VerticalTextAlignment = TextAlignment.Center,
};
layout.Children.Add(label);
var username = new Entry { Placeholder = "Username" };
username.SetBinding(Entry.TextProperty, LoginViewModel.UsernamePropertyName);
layout.Children.Add(username);
var password = new Entry { Placeholder = "Password", IsPassword = true };
password.SetBinding(Entry.TextProperty, LoginViewModel.PasswordPropertyName);
layout.Children.Add(password);
var button = new Button { Text = "Sign In", TextColor = Color.White };
button.SetBinding(Button.CommandProperty, LoginViewModel.LoginCommandPropertyName);
layout.Children.Add(button);
Content = new ScrollView { Content = layout };
}
示例11: ConfigSpringboard
public ConfigSpringboard()
{
NavigationPage.SetHasNavigationBar (this, false);
Grid configGrid = new Grid {
BackgroundColor = Colours.BG_DARK,
Padding = new Thickness(10),
RowDefinitions = {
new RowDefinition {
Height = new GridLength(150, GridUnitType.Absolute)
}
},
ColumnDefinitions = {
new ColumnDefinition {
Width = new GridLength(1, GridUnitType.Star)
},
new ColumnDefinition {
Width = new GridLength(1, GridUnitType.Star)
}
}
};
HomeButton UC = new HomeButton (IconLabel.Icon.FAUser, "YOUR INFO", Colours.USERCONFIG_LIGHT, Colours.USERCONFIG_MEDIUM);
HomeButton AC = new HomeButton (IconLabel.Icon.FABell, "ALERTS CONFIG", Colours.ALERTSCONFIG_LIGHT, Colours.ALERTSCONFIG_MEDIUM);
var alertConfigTapGestureRecognizer = new TapGestureRecognizer ();
alertConfigTapGestureRecognizer.Tapped += async (s, e) => {
if (AC.IsEnabled) {
AC.IsEnabled = false;
await AC.ScaleTo(.8, 100);
await AC.ScaleTo(1, 100);
await Navigation.PushAsync (await AlertConfigContainer.CreateAlertConfigContainer());
AC.IsEnabled = true;
}
};
AC.GestureRecognizers.Add (alertConfigTapGestureRecognizer);
var userConfigTapGestureRecognizer = new TapGestureRecognizer ();
userConfigTapGestureRecognizer.Tapped += async (s, e) => {
if (UC.IsEnabled) {
UC.IsEnabled = false;
await UC.ScaleTo(.8, 100);
await UC.ScaleTo(1, 100);
await Navigation.PushAsync (await YourInfoPageContainer.CreateYourInfoPageContainer());
UC.IsEnabled = true;
}
};
UC.GestureRecognizers.Add (userConfigTapGestureRecognizer);
configGrid.Children.Add (UC, 0, 0);
configGrid.Children.Add (AC, 1, 0);
ScrollView scrollView = new ScrollView {
Orientation = ScrollOrientation.Vertical,
Content = configGrid,
VerticalOptions = LayoutOptions.FillAndExpand
};
Content = scrollView;
}
示例12: AddTaxaPage
//private bool _taxaTxtChanged;
public AddTaxaPage(string title) {
var scrollView = new ScrollView();
var contentStack = new StackLayout {
VerticalOptions = LayoutOptions.Start,
HorizontalOptions = LayoutOptions.Start
};
_taxaStack = new StackLayout {
Orientation = StackOrientation.Vertical,
HorizontalOptions = LayoutOptions.FillAndExpand
};
var numLabel = new Label { Text = "Enter Number of Taxa:" };
_numEntry = new Entry { WidthRequest = 50 };
_numEntry.Completed += NumTaxa_OnCompleted;
_numEntry.Keyboard = Keyboard.Numeric;
_numEntry.BindingContext = new EntryRestrictions();
_numEntry.SetBinding(Entry.TextProperty, "Num1To99");
contentStack.Children.Add(numLabel);
contentStack.Children.Add(_numEntry);
_noteLabel = new Label { Text = "These are the organisms you will be comparing." };
contentStack.Children.Add(_noteLabel);
contentStack.Children.Add(_taxaStack);
_addTaxaBtn.Clicked += OnAddTaxa;
_addTaxaBtn.BackgroundColor = Color.Accent;
_addTaxaBtn.IsEnabled = false;
_addTaxaBtn.IsVisible = false;
contentStack.Children.Add(_addTaxaBtn);
scrollView.Content = contentStack;
Content = scrollView;
Title = title;
}
示例13: CameraView
public CameraView ()
{
done = false;
this.layout = new StackLayout{ Padding = 10 };
btn = new Button ();
btn1 = new Button ();
btn2 = new Button ();
btn.Text = "Take picture";
btn1.Text = " Select Picture";
btn2.Text = "Add ticket";
imgByte = null;
_imageSource = new Image ();
_imageSource.Aspect = Aspect.AspectFill;
layout.Children.Add (btn);
layout.Children.Add (btn1);
layout.Children.Add (_imageSource);
btn.Clicked+= Btn_Clicked;
btn1.Clicked+= Btn1_Clicked;
btn2.Clicked+= Btn2_Clicked;
Content = new ScrollView { Content = layout };
}
示例14: GameDetailPage
public GameDetailPage()
{
Content = new ScrollView () {
Content = new StackLayout () {
Padding = new Thickness(0,0,0,30),
Orientation = StackOrientation.Vertical,
VerticalOptions = LayoutOptions.Start,
Children = {
Picture (),
Space(),
GameName(),
HorzLine (),
GamePrice (),
HorzLine (),
GameCount (),
Space2 (),
GameMenu (),TotalGamePicker (),
AddtoCartButton ()
}
}
};
}
示例15: 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;
}