当前位置: 首页>>代码示例>>C#>>正文


C# ActivityIndicator.SetBinding方法代码示例

本文整理汇总了C#中Xamarin.Forms.ActivityIndicator.SetBinding方法的典型用法代码示例。如果您正苦于以下问题:C# ActivityIndicator.SetBinding方法的具体用法?C# ActivityIndicator.SetBinding怎么用?C# ActivityIndicator.SetBinding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Xamarin.Forms.ActivityIndicator的用法示例。


在下文中一共展示了ActivityIndicator.SetBinding方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RssFeedView2

        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;
        }
开发者ID:jeffbmiller,项目名称:RSSFeeds,代码行数:31,代码来源:RssFeedView2.cs

示例2: PublicRoomsPage

        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
                        }
            };
        }
开发者ID:alexnaraghi,项目名称:SharedSquawk,代码行数:32,代码来源:PublicRoomsPage.cs

示例3: EventListView

        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;
        }
开发者ID:sguertl,项目名称:MeetupEvents-XamarinForms,代码行数:31,代码来源:EventListView.cs

示例4: HomePage

		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}
			};
		}
开发者ID:fabianwilliams,项目名称:HowToActivityIndicatorInCode,代码行数:34,代码来源:HomePage.cs

示例5: EmployeeListViewPage

        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;
        }
开发者ID:XnainA,项目名称:InsideInning,代码行数:31,代码来源:EmployeeListViewPage.cs

示例6: BalanceLeaveViewPage

        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;
        }
开发者ID:XnainA,项目名称:InsideInning,代码行数:32,代码来源:BalanceLeaveViewPage.cs

示例7: GroupMatchView

        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;
        }
开发者ID:AjourMedia,项目名称:FootballTournament2014,代码行数:60,代码来源:GroupMatchView.cs

示例8: MonkeyListPage

        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;
        }
开发者ID:frankcalise,项目名称:xamarin-nycmonkeys,代码行数:58,代码来源:MonkeyListPage.cs

示例9: SettingsUserView

        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);
            
        }
开发者ID:asthanarht,项目名称:CodeProject,代码行数:55,代码来源:SettingsUserView+.cs

示例10: ActiveChatsPage

        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
                }
            };
        }
开发者ID:alexnaraghi,项目名称:SharedSquawk,代码行数:54,代码来源:ActiveChatsPage.cs

示例11: CreateActivityIndicator

		View CreateActivityIndicator ()
		{
			var activityIndicator = new ActivityIndicator
			{
				Color = Color.Black,
			};
			activityIndicator.SetBinding(ActivityIndicator.IsVisibleProperty, "IsBusy");
			activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy");

			return activityIndicator;
		}
开发者ID:vgvassilev,项目名称:couchbase-connect-14,代码行数:11,代码来源:HomeView.cs

示例12: ArticleView

        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;
        }
开发者ID:Ontropix,项目名称:onliner-reader,代码行数:52,代码来源:ArticleView.cs

示例13: CreateLoadingIndicator

 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;
 }
开发者ID:amolkhot,项目名称:xamarin-forms-timesheet,代码行数:13,代码来源:BaseContentPage.cs

示例14: OnlineUsersPage

        public OnlineUsersPage(ViewModelBase viewModel)
            : base(viewModel)
        {
            var usersCountLabel = new SquawkLabel () {
            };
            usersCountLabel.SetBinding(Label.TextProperty, new Binding("Users.Count", stringFormat: "     {0} users online"));

            var filterEntry = new SquawkEntry () {
                Placeholder = "Filter...",
            };
            filterEntry.SetBinding (Entry.TextProperty, new Binding ("FilterText"));

            var listView = new BindableListView
                {
                    ItemTemplate = new DataTemplate(() =>
                        {
                            var imageCell = new ImageCell
                                {
                                    ImageSource = Styling.ContactIcon
                                };
                            imageCell.SetBinding(TextCell.TextProperty, new Binding("Name"));
                            imageCell.SetBinding(TextCell.DetailProperty, new Binding("Description"));
                            imageCell.TextColor = Styling.CellTitleColor;
                            imageCell.DetailColor = Styling.CellDetailColor;
                            return imageCell;
                        })
                };

            listView.SetBinding(ListView.ItemsSourceProperty, new Binding("UsersDisplay"));
            listView.SetBinding(BindableListView.ItemClickedCommandProperty, new Binding("SelectUserCommand"));

            var loadingIndicator = new ActivityIndicator ();
            loadingIndicator.SetBinding(ActivityIndicator.IsRunningProperty, new Binding("IsBusy"));
            loadingIndicator.SetBinding(ActivityIndicator.IsVisibleProperty, new Binding("IsBusy"));

            Content = new StackLayout {
                Children = {
                    new StackLayout {Children =
                        {
                            usersCountLabel,
                            filterEntry,
                            loadingIndicator
                        },
                        BackgroundColor = Styling.SubheaderYellow,
                        Padding = new Thickness(3)
                    },
                    listView
                }
            };
        }
开发者ID:alexnaraghi,项目名称:SharedSquawk,代码行数:50,代码来源:OnlineUsersPage.cs

示例15: PodcastView

        public PodcastView()
        {
            BindingContext = new PodcastViewModel();

            var refresh = new ToolbarItem {
                Command = ViewModel.LoadItemsCommand,
                Icon = "refresh.png",
                Name = "refresh",
                Priority = 0
            };

            ToolbarItems.Add (refresh);

            var stack = new StackLayout {
                Orientation = StackOrientation.Vertical,
                Padding = new Thickness(0, 8, 0, 8)
            };

            var activity = new ActivityIndicator {
                Color = Helpers.Color.Greenish.ToFormsColor(),
                IsEnabled = true
            };
            activity.SetBinding (ActivityIndicator.IsVisibleProperty, "IsBusy");
            activity.SetBinding (ActivityIndicator.IsRunningProperty, "IsBusy");

            stack.Children.Add (activity);

            var listView = new ListView();

            listView.ItemsSource = ViewModel.Podcasts;

            var cell = new DataTemplate(typeof(ListTextCell));

            cell.SetBinding (TextCell.TextProperty, "Title");
            cell.SetBinding (TextCell.DetailProperty, "Details");

            listView.ItemTapped +=  (sender, args) => {
                if(listView.SelectedItem == null)
                    return;

                this.Navigation.PushAsync(new PodcastDetalView(listView.SelectedItem as Podcast));
                listView.SelectedItem = null;
            };

            listView.ItemTemplate = cell;

            stack.Children.Add (listView);

            Content = stack;
        }
开发者ID:AjourMedia,项目名称:FootballTournament2014,代码行数:50,代码来源:PodcastView.cs


注:本文中的Xamarin.Forms.ActivityIndicator.SetBinding方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。