public HomePage () { // setup your ViewModel ViewModel = new HomePageViewModel { ButtonText = "Click Me!" }; // Set the binding context to the newly created ViewModel BindingContext = ViewModel; // the button is what we're going to use to trigger a long running Async task // we're also going to bind the button text so that we can see the binding in action var actionButton = new Button(); actionButton.SetBinding(Button.TextProperty, "ButtonText"); actionButton.Clicked += async (sender, args) => await SomeLongRunningTaskAsync(); // here's your activity indicator, it's bound to the IsBusy property of the BaseViewModel // those bindings are on both the visibility property as well as the IsRunning property var activityIndicator = new ActivityIndicator { Color = Color.Black, }; activityIndicator.SetBinding(ActivityIndicator.IsVisibleProperty, "IsBusy"); activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy"); // return the layout that includes all the above elements Content = new StackLayout { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.White, Children = {actionButton, activityIndicator} }; }
public PublicRoomsPage(ViewModelBase viewModel) : base(viewModel) { var listView = new BindableListView { ItemTemplate = new DataTemplate(() => { var textCell = new TextCell(); textCell.SetBinding(TextCell.TextProperty, new Binding("Name")); textCell.TextColor = Styling.BlackText; //textCell.SetBinding(TextCell.DetailProperty, new Binding("Description")); return textCell; }), SeparatorVisibility = SeparatorVisibility.None }; listView.SetBinding(ListView.ItemsSourceProperty, new Binding("PublicRooms")); listView.SetBinding(BindableListView.ItemClickedCommandProperty, new Binding("SelectRoomCommand")); var loadingIndicator = new ActivityIndicator (); loadingIndicator.SetBinding(ActivityIndicator.IsRunningProperty, new Binding("IsBusy")); loadingIndicator.SetBinding(ActivityIndicator.IsVisibleProperty, new Binding("IsBusy")); Content = new StackLayout { Children = { loadingIndicator, listView } }; }
public EmployeeListViewPage() { BindingContext = new EmployeeViewModel(); var activity = new ActivityIndicator { HorizontalOptions = LayoutOptions.CenterAndExpand, Color = Color.White, //IsEnabled = true }; activity.SetBinding(ActivityIndicator.IsVisibleProperty, "IsBusy"); activity.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy"); //Command ViewModel.LoadAllEmployees.Execute(null); _iiEmpList = new iiListView() { ItemTemplate = new DataTemplate(typeof(EmployeeNameCell)), ClassId="1", RowHeight=70 }; Content = new StackLayout { Children = { activity, _iiEmpList } }; _iiEmpList.ItemTapped += _iiEmpList_ItemTapped; }
public LoadingPlaceholder () { Padding = new Thickness (20); Title = "Image Loading Gallery"; var source = new UriImageSource { Uri = new Uri ("http://www.nasa.gov/sites/default/files/styles/1600x1200_autoletterbox/public/images/298773main_EC02-0282-3_full.jpg"), CachingEnabled = false }; var image = new Image { Source = source, WidthRequest = 200, HeightRequest = 200, }; var indicator = new ActivityIndicator {Color = new Color (.5),}; indicator.SetBinding (ActivityIndicator.IsRunningProperty, "IsLoading"); indicator.BindingContext = image; var grid = new Grid(); grid.RowDefinitions.Add (new RowDefinition()); grid.Children.Add (image); grid.Children.Add (indicator); Content = grid; }
public async void GetContent() { indicator = new ActivityIndicator { IsRunning = true, Color = Color.Black, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand }; layout.Children.Add (indicator); List<UserListModel> userList = await UserControl.GetUserListAsync (); layout.Children.Remove (indicator); userListView = new ListView { ItemsSource = userList, ItemTemplate = new DataTemplate (typeof(UserCell)), RowHeight = 80 }; userListView.ItemTapped += (object sender, ItemTappedEventArgs e) => { UserListModel cell = e.Item as UserListModel; Navigation.PushAsync(new UserPage(cell.UserId)); userListView.SelectedItem = null; }; layout.Children.Add (userListView); }
public AlertView() { Device.OnPlatform (() => { Padding = new Thickness (0, 40, 0, 0); }); this.BackgroundColor = Color.Gray; var label = new LabelRender(); var loading = new ActivityIndicator(){ IsRunning = true}; this.Children.Add(loading); label.Text = TextConstant.Wait; label.TextColor = Color.White; label.HorizontalOptions = LayoutOptions.CenterAndExpand; label.VerticalOptions = LayoutOptions.CenterAndExpand; this.HorizontalOptions = LayoutOptions.CenterAndExpand; this.Children.Add(label); this.WidthRequest = 200; this.HeightRequest = 80; }
public ActivityIndicatorDemoPage() { Label header = new Label { Text = "ActivityIndicator", Font = Font.BoldSystemFontOfSize(40), HorizontalOptions = LayoutOptions.Center }; ActivityIndicator activityIndicator = new ActivityIndicator { Color = Device.OnPlatform(Color.Black, Color.Default, Color.Default), IsRunning = true, VerticalOptions = LayoutOptions.CenterAndExpand }; // Accomodate iPhone status bar. this.Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5); // Build the page. this.Content = new StackLayout { Children = { header, activityIndicator } }; }
public GroupMatchView() { BindingContext = new GroupMatchesViewModel(); var activity = new ActivityIndicator { Color = Helpers.Color.Greenish.ToFormsColor(), IsEnabled = true }; activity.SetBinding(ActivityIndicator.IsVisibleProperty, "IsBusy"); activity.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy"); this.Groups = new ObservableCollection<GroupHelper>(); var refresh = new ToolbarItem { Command = ViewModel.LoadItemsCommand, Icon = "refresh.png", Name = "refresh", Priority = 0 }; ToolbarItems.Add(refresh); ViewModel.ItemsLoaded += new EventHandler((sender, e) => { this.Groups.Clear(); ViewModel.Result.Select(r => r.MatchDate).Distinct().ToList() .ForEach(r => Groups.Add(new GroupHelper(r))); foreach (var g in Groups) { foreach (var match in ViewModel.Result.Where(m=> m.MatchDate == g.Date)) { g.Add(match); } } }); Title = "Group Match Schedule"; var stack = new StackLayout { Orientation = StackOrientation.Vertical, Padding = new Thickness(0, 0, 0, 8) }; var listView = new ListView { IsGroupingEnabled = true, GroupDisplayBinding = new Binding("Date"), }; var viewTemplate = new DataTemplate(typeof(ScoreCell)); listView.ItemTemplate = viewTemplate; listView.ItemsSource = Groups; stack.Children.Add(activity); stack.Children.Add(listView); Content = stack; }
public AbsoluteOverlay() { _indicator = new ActivityIndicator { Color = Color.White, }; _label = new Label { TextColor = Color.White, FontSize = Device.GetNamedSize (NamedSize.Small, typeof(Label)) }; _overlay = new StackLayout { BackgroundColor = Color.Black, Opacity = .5f, Children = { new StackLayout { HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand, Children = { _indicator, _label } } } }; Hide (); }
public DeparturesContentPage (Route selectedRoute) { var indicator = new ActivityIndicator() { HorizontalOptions = LayoutOptions.CenterAndExpand }; this.Title = "Departures"; var listView = new ListView { ItemTemplate = new DataTemplate (typeof(TextCell)) { Bindings = { { TextCell.TextProperty, new Binding ("Time") } } } }; var root = new StackLayout() { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Children = { listView, indicator } }; this.Content = root; Initialize (selectedRoute,listView,indicator); }
public BalanceLeaveViewPage() { BindingContext = new EmployeeViewModel(); var activity = new ActivityIndicator { HorizontalOptions = LayoutOptions.CenterAndExpand, Color = Color.White.ToFormsColor(), //IsEnabled = true }; activity.SetBinding(ActivityIndicator.IsVisibleProperty, "IsBusy"); activity.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy"); ViewModel.LoadAllEmployees.Execute(null); listView = new iiListView() { ItemTemplate = new DataTemplate(typeof(NameCell)) }; BackgroundImage = "back"; Content = new StackLayout { // HorizontalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness(20, 70, 20, 20), Spacing=20, Children = { activity, listView, GenCalGrid(), } }; listView.ItemTapped += listView_ItemTapped; }
public EventListView(EventViewModel viewModel) { BindingContext = viewModel; var stack = new StackLayout { Orientation = StackOrientation.Vertical, Padding = new Thickness(0, 10) }; var progress = new ActivityIndicator { IsEnabled = true, Color = Color.White }; progress.SetBinding(IsVisibleProperty, "IsBusy"); progress.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy"); stack.Children.Add(progress); var listView = new ListView {ItemsSource = viewModel.Events}; var itemTemplate = new DataTemplate(typeof (TextCell)); itemTemplate.SetBinding(TextCell.TextProperty, "Name"); listView.ItemTemplate = itemTemplate; stack.Children.Add(listView); Content = stack; }
public ActivityIndicatorDemoPage() { Label header = new Label { Text = "ActivityIndicator", Font = Font.SystemFontOfSize(40, FontAttributes.Bold), HorizontalOptions = LayoutOptions.Center }; ActivityIndicator activityIndicator = new ActivityIndicator { Color = Device.OnPlatform(Color.Black, Color.Default, Color.Default), IsRunning = true, VerticalOptions = LayoutOptions.CenterAndExpand }; // Build the page. this.Content = new StackLayout { Children = { header, activityIndicator } }; }
public BaseAsyncActivityTemplate() { // Adds the Content Presenter var contentPresenter = new ContentPresenter(); Children.Add(contentPresenter, 0, 0); // The overlay that is presented when an Activity is Running var overlayGrid = new Grid { BackgroundColor = Color.FromHex("#CCCCCCCC") }; overlayGrid.SetBinding(IsVisibleProperty, new TemplateBinding("IsActivityRunning")); var descriptionLabel = new Label { TextColor = Color.White }; descriptionLabel.SetBinding(Label.TextProperty, new TemplateBinding("ActivityDescription")); var activityIndicator = new ActivityIndicator { Color = Color.White }; activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, new TemplateBinding("IsActivityRunning")); // A layout to hold the Activity Indicator and Description var activityIndicatorLayout = new StackLayout { HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, }; activityIndicatorLayout.Children.Add(activityIndicator); activityIndicatorLayout.Children.Add(descriptionLabel); // Finally add the indicator to the overlay and the overlay to the grid overlayGrid.Children.Add(activityIndicatorLayout, 0, 0); Children.Add(overlayGrid); }
public RssFeedView2() { this.viewModel = new RssFeedViewModel(); this.BindingContext = viewModel; this.Title = "Rss Feed"; var refresh = new ToolbarItem(){ Command = viewModel.ReloadCommand, Name = "Reload", Priority = 0 }; ToolbarItems.Add(refresh); var stack = new StackLayout(){ Orientation = StackOrientation.Vertical }; var activity = new ActivityIndicator(){ Color = Color.Blue, IsEnabled = true }; activity.SetBinding(ActivityIndicator.IsVisibleProperty, "ShowActivityIndicator"); activity.SetBinding(ActivityIndicator.IsRunningProperty, "ShowActivityIndicator"); stack.Children.Add(activity); var listview = new ListView(); listview.ItemsSource = viewModel.Records; var cell = new DataTemplate(typeof(ImageCell)); cell.SetBinding(ImageCell.TextProperty, "Title"); cell.SetBinding(ImageCell.ImageSourceProperty, "Image"); listview.ItemTemplate = cell; listview.ItemSelected += async (sender, e) => { await Navigation.PushAsync(new RssWebView((RssRecordViewModel)e.SelectedItem)); listview.SelectedItem = null; }; stack.Children.Add(listview); Content = stack; }
public ListViewPageCS() { AddListItem(n); // ListView のセルを定義します。 var cell = new DataTemplate(typeof(TextCell)); cell.SetBinding(TextCell.TextProperty, "TextItem"); cell.SetBinding(TextCell.DetailProperty, "DetailItem"); // ListView を定義します。 var list = new ListView { ItemsSource = listItems, ItemTemplate = cell, }; var indicator = new ActivityIndicator { IsRunning = true, }; stack = new StackLayout { IsVisible = false, Padding = 10, Children = { indicator, }, }; // ListView の各 Item が表示された時にイベントが発生します。 list.ItemAppearing += async (object sender, ItemVisibilityEventArgs e) => { #if DEBUG System.Diagnostics.Debug.WriteLine((e.Item as ListItem).TextItem); System.Diagnostics.Debug.WriteLine("LastData is " + listItems.Last().TextItem); #endif // ObservableCollection の最後が ListView の Item と一致した時に ObservableCollection にデータを追加するなどの処理を行ってください。 if (listItems.Last() == e.Item as ListItem) { stack.IsVisible = true; await Task.Delay(2000); n++; AddListItem(cellAmount * n); stack.IsVisible = false; } }; Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0); Content = new StackLayout { Children = { list, stack, }, }; }
public MonkeyListPage() { var spinner = new ActivityIndicator(); spinner.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy"); spinner.SetBinding(ActivityIndicator.IsVisibleProperty, "IsBusy"); spinner.Color = Color.Blue; var list = new ListView(); list.SetBinding(ListView.ItemsSourceProperty, "MonkeyList"); var cell = new DataTemplate(typeof(ImageCell)); cell.SetBinding(ImageCell.TextProperty, "Name"); cell.SetBinding(ImageCell.DetailProperty, "Location"); cell.SetBinding(ImageCell.ImageSourceProperty, "Image"); list.ItemTemplate = cell; //listView // --> ItemTemplate // ----> DataTemplate // -------> Cell var getMonkeys = new Button { Text = "Get Monkeys" }; getMonkeys.Clicked += async (sender, e) => { try { await _viewModel.GetMonkeysAsync(); } catch { DisplayAlert("Error", "No Monkeys Found :(", "OK"); } }; list.ItemTapped += async (sender, e) => { var detail = new MonkeyPage(); detail.BindingContext = e.Item; await Navigation.PushAsync(detail); list.SelectedItem = null; }; Content = new StackLayout { Children = { spinner, list, getMonkeys } }; BindingContext = _viewModel; }
public MatchListPage () { Title = "Match List"; busyIcon = new ActivityIndicator (); matchData = new ObservableCollection<RobotMatch> (); matchData.Add (new RobotMatch (1, null)); matchData.Add (new RobotMatch (2, null)); //This provides space between the iOS status bar and the rest of the page this.Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0); StackLayout stack = new StackLayout (); stack.Spacing = 5; listView = new ListView (); listView.ItemTapped += (sender, e) => { // do something with e.Item ((ListView)sender).SelectedItem = null; // de-select the row }; listView.ItemSelected += (sender, e) => { if (e.SelectedItem == null) { return; // don't do anything if we just de-selected the row } // do something with e.SelectedItem ParseObject ob = ((RobotMatch)e.SelectedItem).Data; Navigation.PushAsync (new InterfacePage (ob)); ((ListView)sender).SelectedItem = null; // de-select the row }; DataTemplate template = new DataTemplate (typeof (RobotsCell)); template.SetBinding (RobotsCell.TextProperty, "MatchName"); template.SetBinding (RobotsCell.DetailProperty, "CreatedDate"); //Dont need since SelectedItem == MatchData template.SetBinding (RobotsCell.CellParseDataProperty , "Data"); listView.ItemTemplate = template; Button addMatchBtn = new Button (); addMatchBtn.Text = "New Match"; addMatchBtn.TextColor = Color.White; addMatchBtn.BackgroundColor = Color.Fuschia; addMatchBtn.Clicked += (object sender, EventArgs e) => { busyIcon.IsVisible = true; busyIcon.IsRunning = true; AddNewMatch(); }; listView.ItemsSource = matchData; stack.Children.Add (busyIcon); stack.Children.Add (addMatchBtn); stack.Children.Add (listView); this.Content = stack; }
public MyPage() { // ActivityIndicator を生成する var ac = new ActivityIndicator { Color = Device.OnPlatform(Color.Black, Color.Default, Color.Default), IsRunning = true, // 回転中 VerticalOptions = LayoutOptions.CenterAndExpand // 中央に配置する }; // ActivityIndicatorのみをコンテンツとして配置する Content = ac; }
private void InitializeComponent() { this.LoadFromXaml(typeof(WelcomePage)); Logo = this.FindByName<Image>("Logo"); EntryTitle = this.FindByName<global::DRS.EntryTitle>("EntryTitle"); EntryTitle2 = this.FindByName<global::DRS.EntryTitle>("EntryTitle2"); loading = this.FindByName<ActivityIndicator>("loading"); sign = this.FindByName<global::DRS.pressButton>("sign"); signup = this.FindByName<global::DRS.pressButton>("signup"); }
public SettingsUserView() { BindingContext = profileViewModel = new ProfileViewModel(); profileViewModel.GetCPFeedCommand.Execute(null); var activityIndicator = new ActivityIndicator { Color = Color.Black, }; activityIndicator.SetBinding(IsVisibleProperty, "IsBusy"); activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy"); var circleImage = new CircleImage { BorderColor = Color.White, BorderThickness = 2, HeightRequest = 80, WidthRequest = 80, Aspect = Aspect.AspectFill, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, Source = new UriImageSource { Uri = new Uri("http://bit.ly/1s07h2W"), CacheValidity = TimeSpan.FromDays(30) }, }; var label = new Label() { Text = "User", TextColor = Color.White, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, }; Content = new StackLayout() { Padding = new Thickness(0, 10, 0, 0), Spacing = 15, Orientation = StackOrientation.Vertical, Children = {circleImage, label, activityIndicator, } }; circleImage.SetBinding(CircleImage.SourceProperty, "Avatar"); label.SetBinding(Label.TextProperty, "DisplayName"); //var tapGestureRecognizer = new TapGestureRecognizer(); //tapGestureRecognizer.Tapped += // (sender, e) => // Navigation.PushModalAsync(new NavigationPage(new Profile(profileViewModel.myProfile)) { BarBackgroundColor = App.BrandColor }); //circleImage.GestureRecognizers.Add(tapGestureRecognizer); }
protected AbsoluteLayout BusyIndicator(View content, ActivityIndicator indicator) { var overlay = new AbsoluteLayout(); AbsoluteLayout.SetLayoutFlags(content, AbsoluteLayoutFlags.PositionProportional); AbsoluteLayout.SetLayoutBounds(content, new Rectangle(0f, 0f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize)); AbsoluteLayout.SetLayoutFlags(indicator, AbsoluteLayoutFlags.PositionProportional); AbsoluteLayout.SetLayoutBounds(indicator, new Rectangle(0.5, 0.5, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize)); overlay.Children.Add(content); overlay.Children.Add(indicator); return overlay; }
ContentView GetHeader() { var activity = new ActivityIndicator (); activity.IsRunning = true; activity.Color = ScoresAppStyleKit.NavigationBarBackgroundColor; return new ContentView { Padding = new Thickness(0,20,0,0), Content = activity }; }
View CreateActivityIndicator () { var activityIndicator = new ActivityIndicator { Color = Color.Black, }; activityIndicator.SetBinding(ActivityIndicator.IsVisibleProperty, "IsBusy"); activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy"); return activityIndicator; }
public ActiveChatsPage(ViewModelBase viewModel) : base(viewModel) { var listView = new BindableListView { ItemTemplate = new DataTemplate(() => { var imageCell = new ImageCell(); imageCell.SetBinding(ImageCell.TextProperty, new Binding("Name")); imageCell.SetBinding(ImageCell.DetailProperty, new Binding("DescriptionText")); imageCell.SetBinding(ImageCell.ImageSourceProperty, new Binding("Image")); imageCell.TextColor = Styling.CellTitleColor; imageCell.DetailColor = Styling.CellDetailColor; return imageCell; }), SeparatorVisibility = SeparatorVisibility.None }; listView.SetBinding(ListView.ItemsSourceProperty, new Binding("ActiveChats")); listView.SetBinding(BindableListView.ItemClickedCommandProperty, new Binding("SelectActiveChatCommand")); listView.SetBinding(ListView.IsVisibleProperty, new Binding("HasConversations", BindingMode.OneWay)); var noItemsLabel = new Label { Text = "Start a conversation or open a room!", HorizontalOptions = LayoutOptions.Center, FontSize = 16, TextColor = Color.Gray }; var noItemsLayout = new StackLayout { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, Children = { new BoxView{HeightRequest = 20}, noItemsLabel } }; noItemsLayout.SetBinding(StackLayout.IsVisibleProperty, new Binding("HasConversations", BindingMode.OneWay, converter: new InverterConverter())); var loadingIndicator = new ActivityIndicator (); loadingIndicator.SetBinding(ActivityIndicator.IsRunningProperty, new Binding("IsBusy")); loadingIndicator.SetBinding(ActivityIndicator.IsVisibleProperty, new Binding("IsBusy")); Content = new StackLayout { Children = { loadingIndicator, listView, noItemsLayout } }; }
private void InitializeComponent() { this.LoadFromXaml(typeof(DoctorRating)); Information = this.FindByName<Label>("Information"); loading = this.FindByName<ActivityIndicator>("loading"); RatingLable = this.FindByName<Label>("RatingLable"); Rating = this.FindByName<global::DRS.ListOfCities>("Rating"); Comment = this.FindByName<Entry>("Comment"); PostingComment = this.FindByName<ActivityIndicator>("PostingComment"); listView = this.FindByName<ListView>("listView"); }
private void InitializeComponent() { this.LoadFromXaml(typeof(DoctorsSearch)); City = this.FindByName<Button>("City"); CityLoad = this.FindByName<ActivityIndicator>("CityLoad"); Hospital = this.FindByName<Button>("Hospital"); HospitalLoad = this.FindByName<ActivityIndicator>("HospitalLoad"); Specialty = this.FindByName<Button>("Specialty"); SpecialtyLoad = this.FindByName<ActivityIndicator>("SpecialtyLoad"); SearchButton = this.FindByName<Button>("SearchButton"); Cover = this.FindByName<Button>("Cover"); }
public MainPage() { var listView = new ListView(); //Create buttons var btnMenuPage = new Button { Text = "Go To MenuPage", BackgroundColor = Color.Red, VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.FillAndExpand }; var btnSettingsMenu = new Button { Text = "Go To Settings", BackgroundColor = Color.Gray, VerticalOptions = LayoutOptions.End, HorizontalOptions = LayoutOptions.FillAndExpand }; //Events var ai = new ActivityIndicator { IsRunning = true, IsEnabled = true, BindingContext = this }; ai.SetBinding(IsVisibleProperty, "IsBusy"); btnMenuPage.Clicked += async (sender, e) => { try { IsBusy = true; var serviceBusInit = await ServiceBusApi.Fetch(); await Navigation.PushModalAsync(new NavigationPage(new MenuPage(serviceBusInit.MenuItems))); } catch (Exception) { DisplayAlert("Fout", "Geen reactie van de server ontvangen. Controleer instellingen", "OK"); } finally { IsBusy = false; } }; btnSettingsMenu.Clicked += (sender, e) => Navigation.PushModalAsync(new SettingsPage()); Content = new StackLayout { Padding = 20, Children = { listView, ai, btnMenuPage, btnSettingsMenu } }; }
public ArticleView(FeedItem feedItem) { BindingContext = new ArticleViewModel(); ViewModel.ArticleSource = feedItem.Link; Title = feedItem.Title; var activity = new ActivityIndicator { Color = Color.Gray, IsEnabled = true }; activity.SetBinding(ActivityIndicator.IsVisibleProperty, "IsBusy"); activity.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy"); webView = new WebView(); IWindowService windowService = DependencyService.Get<IWindowService>(); Size size = windowService.Bounds; AbsoluteLayout layout = new AbsoluteLayout(); layout.Children.Add(activity, new Rectangle(0, 0, size.Width, 40)); if (Device.OS == TargetPlatform.iOS) { Button comments = new Button() { Text = "Комментарии", BackgroundColor = Color.FromRgba(0.5, 0.5, 0.5, 0.8) }; comments.Clicked += (sender, e) => { Navigation.PushAsync(new CommentsView(ViewModel.Article)); }; layout.Children.Add(comments, new Rectangle(5, size.Height - 110, size.Width - 10, 40)); layout.Children.Add(webView, new Rectangle(0, 0, size.Width, size.Height - 110)); } else { var comments = new ToolbarItem("comments", "comments.png", () => Navigation.PushModalAsync(new CommentsView(ViewModel.Article))); ToolbarItems.Add(comments); layout.Children.Add(webView, new Rectangle(0, 0, size.Width, size.Height)); } Content = layout; }
protected ActivityIndicator CreateLoadingIndicator() { var loadingIndicator = new ActivityIndicator { HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.Start, Scale = 2, Color = Color.Silver }; loadingIndicator.SetBinding(IsVisibleProperty, "IsLoading"); loadingIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsLoading"); return loadingIndicator; }
void ShowSpinner() { Device.BeginInvokeOnMainThread(() => { if (spinnerContentView != null) { return; } if (this.Content is Grid grid) { var rows = grid.RowDefinitions.Count; var columns = grid.ColumnDefinitions.Count; var spinner = new Xamarin.Forms.ActivityIndicator { IsEnabled = true, IsRunning = true, Color = Color.White, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, }; spinnerContentView = new ContentView { BackgroundColor = Color.FromRgba(0, 0, 0, 0.5), HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.Fill, Content = spinner }; if (rows > 0) { Grid.SetRowSpan(spinnerContentView, rows); } if (columns > 0) { Grid.SetColumnSpan(spinnerContentView, columns); } grid.Children.Add(spinnerContentView); } }); }
public ActivityIndicatorHandler(NativeComponentRenderer renderer, XF.ActivityIndicator activityIndicatorControl) : base(renderer, activityIndicatorControl) { ActivityIndicatorControl = activityIndicatorControl ?? throw new ArgumentNullException(nameof(activityIndicatorControl)); Initialize(renderer); }