Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
using System;
using Xamarin.Forms;
namespace xvfgdgfd
{
public class App : Application
{
Label resultsLabel;
SearchBar searchBar;
public App ()
{
resultsLabel = new Label {
Text = "Result will appear here.",
VerticalOptions = LayoutOptions.FillAndExpand,
FontSize = 25
};
searchBar = new SearchBar
{
Placeholder = "Enter search term",
SearchCommand = new Command(() => {resultsLabel.Text = "Result: " + searchBar.Text + " is what you asked for.";})
};
MainPage = new ContentPage {
Content = new StackLayout {
VerticalOptions = LayoutOptions.Start,
Children = {
new Label {
HorizontalTextAlignment = TextAlignment.Center,
Text = "SearchBar",
FontSize = 50
},
searchBar,
new ScrollView
{
Content = resultsLabel,
VerticalOptions = LayoutOptions.FillAndExpand
}
},
Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5)
}
};
}
protected override void OnStart ()
{
// Handle when your app starts
}
protected override void OnSleep ()
{
// Handle when your app sleeps
}
protected override void OnResume ()
{
// Handle when your app resumes
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.