• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# UISearchBar类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ViewDidLoad

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

            FoundCoords += (object sender, CoordEventArgs e) => {
                storageScreenContent.SetCoords(e.Latitude,e.Longitude);
            };

            map = new MKMapView (UIScreen.MainScreen.Bounds);
            View = map;

            // create search controller
            searchBar = new UISearchBar (new RectangleF (0, 0, View.Frame.Width, 50)) {
                Placeholder = "Enter a search query"
            };
            searchController = new UISearchDisplayController (searchBar, this);
            searchController.Delegate = new SearchDelegate (map);
            SearchSource source = new SearchSource (searchController, map);
            searchController.SearchResultsSource = source;
            source.FoundCoords += (object sender, CoordEventArgs e) => {
                var handler = FoundCoords;
                if(handler != null){
                    handler(this,e);
                }
                this.DismissViewController(true,null);
            };
            View.AddSubview (searchBar);
        }
开发者ID:KuroiAme,项目名称:Indexer,代码行数:28,代码来源:AddressLocationFinder.cs


示例2: ViewWillAppear

        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear (animated);

            TableView.Source = new SearchTableSource(this);
            mSearchBar = TableView.TableHeaderView as UISearchBar;

            mSearchBar.Placeholder = "Enter Search Word";
            mSearchBar.SizeToFit();
            mSearchBar.AutocorrectionType = UITextAutocorrectionType.Yes;
            mSearchBar.AutocapitalizationType = UITextAutocapitalizationType.None;
            mSearchBar.SearchButtonClicked += (sender, e) =>
            {
                AddWord(mSearchBar.Text);
            };
            mSearchBar.TextChanged += (sender, e) =>
            {
                mSuggestionModel.NewSuggestion(mSearchBar.Text);
            };

            mSuggestionModel.SuggestionChanged += (sender, e) =>
            {
                this.InvokeOnMainThread(delegate
                {
                    TableView.ReloadData();
                });
            };

            mSearchBar.BecomeFirstResponder ();
        }
开发者ID:vmendi,项目名称:ListenAndRepeat,代码行数:30,代码来源:AddWordController.cs


示例3: CancelButtonClicked

 public override void CancelButtonClicked (UISearchBar searchBar)
 {
     searchBar.ShowsCancelButton = false;
     searchBar.ResignFirstResponder ();
     searchBar.Text = string.Empty;
     _searchTextChanging.OnNext(searchBar.Text);
 }
开发者ID:runt18,项目名称:CodeHub,代码行数:7,代码来源:ObservableSearchDelegate.cs


示例4: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            View.BackgroundColor = UIColor.White;

            TableView.AllowsSelection = true;
            TableView.SetCellStyle(UITableViewCellStyle.Subtitle);
            using (var set = new BindingSet<UITableView, TableViewModel>(TableView))
            {
                var editItem = new UIBarButtonItem { Title = "Edit" };
                editItem.Clicked += (sender, args) =>
                {
                    TableView.Editing = !TableView.Editing;
                    NavigationItem.RightBarButtonItem.Title = TableView.Editing ? "Done" : "Edit";
                };
                var addItem = new UIBarButtonItem { Title = "Add" };
                set.Bind(addItem).To(() => (vm, ctx) => vm.AddCommand);
                NavigationItem.RightBarButtonItems = new[] { editItem, addItem };

                var searchBar = new UISearchBar(new RectangleF(0, 0, 320, 44)) { Placeholder = "Filter..." };
                set.Bind(searchBar).To(() => (vm, ctx) => vm.FilterText).TwoWay();
                TableView.TableHeaderView = searchBar;

                set.Bind(AttachedMemberConstants.ItemsSource)
                    .To(() => (vm, ctx) => vm.GridViewModel.ItemsSource);
                set.Bind(AttachedMemberConstants.SelectedItem)
                    .To(() => (vm, ctx) => vm.GridViewModel.SelectedItem)
                    .TwoWay();
                set.Bind(this, () => controller => controller.Title)
                    .To(() => (vm, ctx) => vm.GridViewModel.SelectedItem.Name)
                    .WithFallback("Nothing selected");
                TableView.SetBindingMemberValue(AttachedMembers.UITableView.ItemTemplateSelector, TableCellTemplateSelector.Instance);
            }
        }
开发者ID:dbeattie71,项目名称:MugenMvvmToolkit.Samples,代码行数:34,代码来源:TableTemplateViewController.cs


示例5: CustomSearchController

		public CustomSearchController (ViewController owner, UISearchBar searchBar, UITableView searchPredictionTable, List<Room> rooms)
		{
			_searchBar = searchBar;
			_searchPredictionTable = searchPredictionTable;
			owner.InvokeOnMainThread (delegate() {
				_searchPredictionTable.Alpha = 0;
			});

			tableSource = new TableSource (owner, rooms);
			_searchPredictionTable.Source = tableSource;

			_searchBar.TextChanged += (sender, e) => {
				owner.InvokeOnMainThread (delegate() {
                    tableSource.tableItems = rooms.FindAll ((room) => room.Name.ToLower().Contains (e.SearchText.ToLower())).ToArray ();
					_searchPredictionTable.ReloadData();
				});
			};

			_searchBar.CancelButtonClicked += (sender, e) => {
				_searchBar.ShowsCancelButton = false;
				_searchBar.ResignFirstResponder();
			};

			_searchBar.OnEditingStarted += (sender, e) => {
				_searchBar.ShowsCancelButton = true;
				_searchPredictionTable.Alpha = 1;
			};
            _searchBar.OnEditingStopped += (sender, e) => {
                _searchPredictionTable.Alpha = 0;
                _searchBar.ResignFirstResponder ();

            };

		}
开发者ID:dcbright01,项目名称:Navigator,代码行数:34,代码来源:CustomSearchController.cs


示例6: LoadView

        public override void LoadView()
        {
            base.LoadView();
            this.IsSearching = false;

            PillboxClient.Initialize();
            _Service = new DBManagerService(@"http://mor.nlm.nih.gov/axis/services/RxNormDBService");

            _SearchBar = new UISearchBar();
            _SearchBar.Text = "sildenafil";
            _SearchBar.Frame = new RectangleF(0, -44, View.Frame.Width, 44);
            _SearchBar.SearchButtonClicked += delegate {
                Search(_SearchBar.Text);
            };
            _SearchBar.CancelButtonClicked += delegate {
                SearchCancelled();
            };

            _SearchingView = new DrugSearchingView(SearchCancelled);
            _SearchingView.Hidden = true;

            this.TableView.ContentInset = new UIEdgeInsets(44, 0, 0, 0);

            this.View.AddSubview(_SearchingView);
            this.View.AddSubview(_SearchBar);
        }
开发者ID:ZAD-Man,项目名称:Zadify,代码行数:26,代码来源:DrugSearchViewController.cs


示例7: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            this.NavigationItem.Title = "Phrases";
            this.NavigationController.NavigationBar.BarStyle = UIBarStyle.BlackOpaque;
            this.NavigationController.NavigationBar.TintColor = UIColor.White;
            this.NavigationController.NavigationBar.BarTintColor = UIColor.FromRGB (0, 176, 202);
            this.NavigationController.NavigationBar.TitleTextAttributes = new UIStringAttributes()
            {
                ForegroundColor = UIColor.White
            };

            // add table view
            var width = View.Bounds.Width;
            var height = View.Bounds.Height;

            table = new UITableView (new CGRect (0, 0, width, height));
            table.AutoresizingMask = UIViewAutoresizing.All;
            table.RowHeight = UITableView.AutomaticDimension;

            //remove seperator lines if cell are empty;
            var frame = new CGRect (0, 0, 0, 0);
            table.TableFooterView = new UIView (frame);

            //add search bar
            UISearchBar searchBar = new UISearchBar ();
            searchBar.SizeToFit ();
            table.TableHeaderView = searchBar;

            DisplayCategories (searchBar);
            Add (table);
        }
开发者ID:Jusliang,项目名称:Ma-Phrase-Book,代码行数:32,代码来源:CategoryScreen.cs


示例8: FlyoutNavigationController

        public FlyoutNavigationController(UITableViewStyle navigationStyle = UITableViewStyle.Plain)
        {
            navigation = new DialogViewController(navigationStyle,null);
            navigation.OnSelection += NavigationItemSelected;
            var navFrame = navigation.View.Frame;
            navFrame.Width = menuWidth;
            navigation.View.Frame = navFrame;
            this.View.AddSubview (navigation.View);
            SearchBar = new UISearchBar (new RectangleF (0, 0, navigation.TableView.Bounds.Width, 44)) {
                //Delegate = new SearchDelegate (this),
                TintColor = this.TintColor
            };

            TintColor = UIColor.Black;
            //navigation.TableView.TableHeaderView = SearchBar;
            navigation.TableView.TableFooterView = new UIView (new RectangleF (0, 0, 100, 100)){BackgroundColor = UIColor.Clear};
            navigation.TableView.ScrollsToTop = false;
            shadowView = new UIView ();
            shadowView.BackgroundColor = UIColor.White;
            shadowView.Layer.ShadowOffset = new System.Drawing.SizeF (-5, -1);
            shadowView.Layer.ShadowColor = UIColor.Black.CGColor;
            shadowView.Layer.ShadowOpacity = .75f;
            closeButton = new UIButton ();
            closeButton.TouchDown += delegate {
                HideMenu ();
            };
            AlwaysShowLandscapeMenu = true;

            this.View.AddGestureRecognizer (new OpenMenuGestureRecognizer (this, new Selector ("panned"), this));

            ShouldAutoPushFirstView = true;
        }
开发者ID:neilkennedy,项目名称:FlyoutNavigation,代码行数:32,代码来源:FlyoutNavigationController.cs


示例9: 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


示例10: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            this.Title = title;

            var frame = new CGRect (0, 0, 0, 0);
            TableView.TableFooterView = new UIView (frame);
            TableView.AutoresizingMask = UIViewAutoresizing.All;
            TableView.RowHeight = UITableView.AutomaticDimension;
            TableView.EstimatedRowHeight = 200f;

            UISearchBar searchBar = new UISearchBar ();
            searchBar.SizeToFit ();
            TableView.TableHeaderView = searchBar;

            UISearchDisplayController searchDisplayController = new UISearchDisplayController(searchBar, this);

            var phraseSource = new PhraseSource (this);
            TableView.Source = phraseSource;

            searchDisplayController.SearchResultsSource = phraseSource;
            searchDisplayController.SearchBar.TextChanged += (sender, e) => {
                string text = e.SearchText.Trim ();
                filteredPhrases = (from phrase in phrases
                    where phrase.sourcePhrase.ToUpper ().Contains (text.ToUpper ())
                   	select phrase).ToList ();
            };
            searchDisplayController.SearchResultsTableView.RowHeight = UITableView.AutomaticDimension;
            searchDisplayController.SearchResultsTableView.EstimatedRowHeight = 200f;

            LoadDataForDisplay ();
        }
开发者ID:Jusliang,项目名称:Ma-Phrase-Book,代码行数:32,代码来源:PhraseScreen.cs


示例11: LoadView

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

            InfosTableView = new UITableView(RectangleF.Empty, UITableViewStyle.Plain)
            {
                Frame = this.ContentFrame(),
                Source = new InfosTableSource(),
                RowHeight = 60
            };
            View.AddSubview(InfosTableView);

            var searchBar = new UISearchBar(RectangleF.Empty)
            {
                ShowsCancelButton = true,
                Placeholder = "Find Currency",
                KeyboardType = UIKeyboardType.ASCIICapable
            };
            searchBar.SizeToFit();
            InfosTableView.TableHeaderView = searchBar;

            SearchController = new UISearchDisplayController(searchBar, this)
            {
                Delegate = new SearchDisplayDelegate(),
                SearchResultsSource = new InfosTableSource()
            };
            SearchController.SearchResultsTableView.RowHeight = 60;
        }
开发者ID:seanho,项目名称:CurrencyApp-MonoTouch,代码行数:28,代码来源:CurrenciesController.cs


示例12: ViewDidLoad

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

			if (cloudManager != null)
				cloudManager.FetchRecords ("SearchRequest", results => {
					previousSearchRequests = results;
					TableView.ReloadData ();
				});

			NavigationItem.HidesBackButton = true;
			TableView.Source = new TableSource (this);
			TableView.AllowsMultipleSelectionDuringEditing = false;

			searchBar = new UISearchBar {
				Placeholder = "search_hint".LocalizedString ("Search text field placeholder"),
				AutocorrectionType = UITextAutocorrectionType.No,
				AutocapitalizationType = UITextAutocapitalizationType.None,
				ShowsCancelButton = true
			};

			searchBar.SizeToFit ();
			searchBar.SearchButtonClicked += (sender, e) => {
				if (cloudManager != null && 
					!previousSearchRequests.Where (record => (NSString)record ["value"] == searchBar.Text).Any ())
					SaveSearchRequest (searchBar.Text);
				
				Search ();
			};

			searchBar.CancelButtonClicked += (sender, e) => NavigationController.PopViewController (false);

			NavigationItem.TitleView = searchBar;
			searchBar.BecomeFirstResponder ();
		}
开发者ID:RobGibbens,项目名称:Coffee-Filter,代码行数:35,代码来源:SearchViewController.cs


示例13: ViewDidLoad

		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			NavBar=new UINavigationBar(new CoreGraphics.CGRect (0, 0, pview.uvWidth, 44));
			NavBar.BackgroundColor = UIColor.Red;
//			UIBarButtonItem bbitemCancel = new UIBarButtonItem (UIBarButtonSystemItem.Cancel, CancelButtonClicked);
			UIButton btnCancel = new UIButton (new CGRect (0, 0, 80, 30));
			btnCancel.SetTitleColor (UIColor.Blue, UIControlState.Normal);
			btnCancel.SetTitle ("Cancel", UIControlState.Normal);
			btnCancel.TouchUpInside += (object sender, EventArgs e) => {
				pview.popover.Dismiss(false);
			};
			UIBarButtonItem bbitemCancel = new UIBarButtonItem (btnCancel);

//			UIBarButtonItem bbitemDone = new UIBarButtonItem (UIBarButtonSystemItem.Done, DoneButtonClicked);
			UIButton btnDone = new UIButton (new CGRect (0, 0, 80, 30));
			btnDone.SetTitleColor (UIColor.Blue, UIControlState.Normal);
			btnDone.SetTitle ("Done", UIControlState.Normal);
			btnDone.TouchUpInside += (object sender, EventArgs e) => {
				pview.DismissPopOver ();
			};
			UIBarButtonItem bbitemDone = new UIBarButtonItem (btnDone);

			UINavigationItem navgitem = new UINavigationItem ("Select");
			navgitem.SetLeftBarButtonItem(bbitemCancel,true);
			navgitem.SetRightBarButtonItem (bbitemDone, true);
			NavBar.PushNavigationItem(navgitem,true);
			this.View.Add (NavBar);
			searchBar=new UISearchBar(new CoreGraphics.CGRect (0, 44, pview.uvWidth, 44));
			this.View.Add(searchBar);
			rvc = new RootViewController (RootData,pview);
			rvc.View.Frame = new CoreGraphics.CGRect (0, 88, pview.uvWidth, 600);
			this.subview.SetRootview(rvc);
			this.View.Add (rvc.View);
		}
开发者ID:Nahidahmed,项目名称:iProPQRS,代码行数:35,代码来源:RootGroupView.cs


示例14: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            this.Title = "My Phrases";

            //create a table
            var width = View.Bounds.Width;
            var height = View.Bounds.Height;
            table = new UITableView (new CGRect (0, 0, width, height));
            table.AutoresizingMask = UIViewAutoresizing.All;
            table.RowHeight = UITableView.AutomaticDimension;
            table.EstimatedRowHeight = 44f;

            //remove seperator lines if cell are empty;
            var frame = new CGRect (0, 0, 0, 0);
            table.TableFooterView = new UIView (frame);

            //add search bar
            UISearchBar searchBar = new UISearchBar ();
            searchBar.SizeToFit ();
            table.TableHeaderView = searchBar;

            DisplayMyPhrases (myPhraseCategoryId, searchBar);
            Add (table);
            DisplayAddMyPhrases ();
        }
开发者ID:Jusliang,项目名称:Ma-Phrase-Book,代码行数:26,代码来源:MyPhraseScreen.cs


示例15: ViewDidLoad

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

            LoadWords ();

            Background back = new Background();
            View.Add(back.View);
            View.SendSubviewToBack (back.View);

            RectangleF resultsRect = new RectangleF (0, 75, View.Bounds.Width, View.Bounds.Height - 75);
            resultsTable = new UITableView (resultsRect);
            resultsTable.BackgroundColor = UIColor.Clear;
            Add (resultsTable);
            searchBar = new UISearchBar (new RectangleF(0, 0, View.Bounds.Width, 40));
            searchBar.Text = this.initialSearch;
            Add (searchBar);

            tableSource = new WordsTableSource(this);
            resultsTable.Source = tableSource;

            searchBar.SearchButtonClicked += (s, e) => searchBar.ResignFirstResponder ();

            // refine the search results every time the text changes
            searchBar.TextChanged += (s, e) => RefineSearchItems ();

            RefineSearchItems ();
        }
开发者ID:KuroiAme,项目名称:Indexer,代码行数:28,代码来源:SearchScreen.cs


示例16: FlyOutNavigationController

        public FlyOutNavigationController()
        {
            navigation = new DialogViewController(UITableViewStyle.Plain,null);
            navigation.OnSelection = NavigationItemSelected;
            var navFrame = navigation.View.Frame;
            navFrame.Width = menuWidth;
            navigation.View.Frame = navFrame;
            this.View.AddSubview(navigation.View);
            SearchBar = new UISearchBar (new RectangleF (0, 0, navigation.TableView.Bounds.Width, 44)) {
            //Delegate = new SearchDelegate (this),
            TintColor = this.TintColor
                };

            TintColor = UIColor.Black;
            //navigation.TableView.TableHeaderView = SearchBar;
            navigation.TableView.TableFooterView = new UIView(new RectangleF(0,0,100,100)){BackgroundColor = UIColor.Clear};
            navigation.TableView.ScrollsToTop = false;
            shadowView = new UIView();
            shadowView.BackgroundColor = UIColor.White;
            shadowView.Layer.ShadowOffset = new System.Drawing.SizeF(-5,-1);
            shadowView.Layer.ShadowColor = UIColor.Black.CGColor;
            shadowView.Layer.ShadowOpacity = .75f;
            closeButton = new UIButton();
            closeButton.TouchDown += delegate {
                HideMenu();
            };
        }
开发者ID:timrisi,项目名称:FlyOutNavigation,代码行数:27,代码来源:FlyOutNavigationController.cs


示例17: TextChanged

		public override void TextChanged (UISearchBar searchBar, string searchText)
		{
			if (this.searchController != null) {
				if (searchText.Length <= 0) {
					TCNotificationCenter.defaultCenter.postNotification (MConstants.kPostSearchBarEmpty, searchText);
				}
			}
		}
开发者ID:borain89vn,项目名称:demo2,代码行数:8,代码来源:TCSearchBarDelegate.cs


示例18: CreateSearchBar

 static UISearchBar CreateSearchBar ()
 {
     UISearchBar search = new UISearchBar ();
     search.Placeholder = "Search Bing";
     search.SizeToFit ();
     search.AutocorrectionType = UITextAutocorrectionType.No;
     search.AutocapitalizationType = UITextAutocapitalizationType.None;
     return search;
 }
开发者ID:enricos,项目名称:learning_monotouch_code,代码行数:9,代码来源:BingSearchController.cs


示例19: OnEditingStopped

		public override void OnEditingStopped(UISearchBar searchbar)
		{
			var searchable = _Container.Root as ISearchBar;
			if (searchable != null && searchable.IncrementalSearch)
			{
				searchbar.ShowsCancelButton = false;
				_Container.FinishSearch(false);
			}
		}
开发者ID:vknair74,项目名称:MonoMobile.Views,代码行数:9,代码来源:DialogViewSearchDelegate.cs


示例20: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            View.BackgroundColor = UIColor.White;

            using (var set = new BindingSet<ProductWorkspaceViewModel>())
            {
                set.Bind(this, () => controller => controller.Title).To(() => (vm, ctx) => vm.DisplayName);

                var addItem = new UIBarButtonItem("Add", UIBarButtonItemStyle.Plain, null);
                set.Bind(addItem).To(() => (vm, ctx) => vm.AddProductCommand);

                var saveItem = new UIBarButtonItem("Save", UIBarButtonItemStyle.Done, null);
                set.Bind(saveItem).To(() => (vm, ctx) => vm.SaveChangesCommand);
                NavigationItem.RightBarButtonItems = new[] { addItem, saveItem };

                var searchBar = new UISearchBar(new CGRect(0, 0, 320, 44)) { Placeholder = "Filter..." };
                set.Bind(searchBar).To(() => (vm, ctx) => vm.FilterText).TwoWay();
                TableView.TableHeaderView = searchBar;

                set.Bind(View, AttachedMembersEx.UIView.IsBusy).To(() => (vm, ctx) => vm.IsBusy);
                set.Bind(View, AttachedMembersEx.UIView.BusyMessage).To(() => (vm, ctx) => vm.BusyMessage);

                set.Bind(TableView, AttachedMembers.UIView.ItemsSource).To(() => (vm, ctx) => vm.GridViewModel.ItemsSource);
                set.Bind(TableView, AttachedMembers.UITableView.SelectedItem)
                    .To(() => (vm, ctx) => vm.GridViewModel.SelectedItem)
                    .TwoWay();
            }

            TableView.SetCellStyle(UITableViewCellStyle.Subtitle);
            TableView.SetCellBind(cell =>
            {
                cell.SetEditingStyle(UITableViewCellEditingStyle.Delete);
                cell.Accessory = UITableViewCellAccessory.DetailDisclosureButton;
                cell.DetailTextLabel.AdjustsFontSizeToFitWidth = true;
                using (var set = new BindingSet<ProductModel>())
                {
                    set.Bind(cell, AttachedMembers.UITableViewCell.AccessoryButtonTappedEvent)
                        .To(() => (m, ctx) => ctx.Relative<UIViewController>().DataContext<ProductWorkspaceViewModel>().EditProductCommand)
                        .OneTime()
                        .WithCommandParameter(() => (m, ctx) => m)
                        .ToggleEnabledState(false);
                    set.Bind(cell, AttachedMembers.UITableViewCell.DeleteClickEvent)
                        .To(() => (m, ctx) => ctx.Relative<UIViewController>().DataContext<ProductWorkspaceViewModel>().RemoveProductCommand)
                        .OneTime()
                        .WithCommandParameter(() => (m, ctx) => m)
                        .ToggleEnabledState(false);
                    set.Bind(cell.TextLabel)
                       .To(() => (m, ctx) => m.Name);
                    set.Bind(cell.DetailTextLabel)
                       .To(() => (m, ctx) => m.Description);
                    set.Bind(cell, AttachedMembers.UITableViewCell.TitleForDeleteConfirmation)
                        .To(() => (m, ctx) => string.Format("Delete {0}", m.Name));
                }
            });
        }
开发者ID:Fezzer,项目名称:MugenMvvmToolkit.Samples,代码行数:56,代码来源:ProductWorkspaceViewController.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# UISegmentedControl类代码示例发布时间:2022-05-24
下一篇:
C# UIScrollView类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap