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


C# UISearchBar.SetShowsCancelButton方法代码示例

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


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

示例1: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var source = new MvxStandardTableViewSource(TableView, "TitleText FullName;ImageUrl Picture");
            TableView.Source = source;

            _searchBar = new UISearchBar();
            _searchBar.Placeholder = "Enter Search Text";
            _searchBar.SetShowsCancelButton(true, true);
            _searchBar.SizeToFit();
            _searchBar.AutocorrectionType = UITextAutocorrectionType.No;
            _searchBar.AutocapitalizationType = UITextAutocapitalizationType.None;
            _searchBar.CancelButtonClicked += SearchBarCancelButtonClicked;
            _searchBar.SearchButtonClicked += (sender, e) => { PerformSearch(); };

            MvxFluentBindingDescriptionSet<FriendsViewController, FriendsViewModel> set =
                this.CreateBindingSet<FriendsViewController, FriendsViewModel>();
            set.Bind(source).To(x => x.Friends);
            set.Bind(source).For(s => s.SelectionChangedCommand).To(vm => vm.ViewDetailsCommand);

            set.Bind(_searchBar).For(x => x.Text).To(vm => vm.SearchTerm);
            set.Apply();

            TableView.ReloadData();

            TableView.TableHeaderView = _searchBar;
        }
开发者ID:slown1,项目名称:Xamarin.Chat,代码行数:28,代码来源:FriendsViewController.cs

示例2: ViewDidLoad

        public override void ViewDidLoad()
        {
            try
            {
                //View = new UniversalView();

                base.ViewDidLoad();
                this.Title = "Derby Events";

                View.Frame = UIScreen.MainScreen.Bounds;
                View.BackgroundColor = UIColor.White;
                View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
                table = new UITableView(new RectangleF(0, 0, View.Bounds.Width, View.Bounds.Height));

                Action<EventsJson> skaters = new Action<EventsJson>(UpdateAdapter);
                Calendar.PullEvents(lastPagePulled, PAGE_COUNT, skaters);
                // Perform any additional setup after loading the view
                loading = new LoadingView();
                loading.ShowActivity("loading events");
                source = new EventsTableView(initialArray.Events, this.NavigationController);
                source.GotCell += source_GotCell;
                table.Source = source;
                table.RowHeight = 80;


                searchBar = new UISearchBar(new RectangleF(0, 0, 200, 44));
                searchBar.SetShowsCancelButton(true, false);
                searchBar.CancelButtonClicked += searchBar_CancelButtonClicked;
                searchBar.SearchButtonClicked += searchBar_SearchButtonClicked;


                this.NavigationItem.SetRightBarButtonItem(new UIBarButtonItem(UIBarButtonSystemItem.Search, (sender, args) =>
    {
        searchBar.BecomeFirstResponder();
        UIView searchBarView = new UIView(new RectangleF(0, 0, 250, 44));
        searchBarView.AddSubview(searchBar);
        this.NavigationItem.TitleView = searchBarView;
    })
, true);

                this.NavigationItem.BackBarButtonItem = new UIBarButtonItem();
                this.NavigationItem.BackBarButtonItem.Title = "Events";

                View.Add(table);
            }
            catch (Exception exception)
            {
                ErrorHandler.Save(exception, MobileTypeEnum.iPhone);
            }

        }
开发者ID:mukhtiarlander,项目名称:git_demo_torit,代码行数:51,代码来源:EventsViewController.cs

示例3: SearchButtonClicked

		public virtual void SearchButtonClicked (UISearchBar searchBar)
		{
			// Tells the postManager to reset the tag string with the new tag string
			postManager.ResetWithTagString (searchBar.Text);
			searchBar.SetShowsCancelButton (false, true);
			searchBar.ResignFirstResponder ();
		}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:7,代码来源:MainViewController.cs

示例4: OnEditingStarted

		public void OnEditingStarted (UISearchBar searchBar)
		{
			searchBar.SetShowsCancelButton (true, true);
		}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:4,代码来源:MainViewController.cs

示例5: CancelButtonClicked

			public override void CancelButtonClicked (UISearchBar searchBar)
			{
				searchBar.Text = "";
				searchBar.SetShowsCancelButton (false, true);
				container.FinishSearch ();
				searchBar.ResignFirstResponder ();
			}
开发者ID:escoz,项目名称:MonoMobile.Forms,代码行数:7,代码来源:DialogViewController.cs

示例6: OnEditingStopped

			public override void OnEditingStopped (UISearchBar searchBar)
			{
				if (searchBar.Text=="")
					searchBar.SetShowsCancelButton (false, true);
				//container.FinishSearch ();
			}
开发者ID:escoz,项目名称:MonoMobile.Forms,代码行数:6,代码来源:DialogViewController.cs

示例7: OnEditingStarted

			public override void OnEditingStarted (UISearchBar searchBar)
			{
				searchBar.SetShowsCancelButton (true, true);
				container.StartSearch ();
			}
开发者ID:escoz,项目名称:MonoMobile.Forms,代码行数:5,代码来源:DialogViewController.cs

示例8: CancelButtonClicked

			public override void CancelButtonClicked (UISearchBar searchBar)
			{
				searchBar.Text = "";
				
				if (container.AutoHideSearch && container.EnableSearch) {
					
					searchBar.SetShowsCancelButton(false, false);

					if (container.TableView.ContentOffset.Y < 44)
						container.TableView.ContentOffset = new PointF (0, 44);
					
				} else {
					searchBar.SetShowsCancelButton(false, true);	
				}
				
				container.FinishSearch ();
				searchBar.ResignFirstResponder ();
			}
开发者ID:chrisntr,项目名称:MonoTouch.Dialog,代码行数:18,代码来源:DialogViewController.cs

示例9: OnEditingStopped

			public override void OnEditingStopped (UISearchBar searchBar)
			{
				if (String.IsNullOrEmpty(searchBar.Text)) {
					searchBar.SetShowsCancelButton(false, true);
					container.FinishSearch ();
				}
			}
开发者ID:chrisntr,项目名称:MonoTouch.Dialog,代码行数:7,代码来源:DialogViewController.cs


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