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 (); }
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 (); }
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); }
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 (); }; }
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 (); }
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(); }; }
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; }
void ReleaseDesignerOutlets() { if (searchBar != null) { searchBar.Dispose (); searchBar = null; } }
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 (); }
void ReleaseDesignerOutlets () { if (gameSearch != null) { gameSearch.Dispose (); gameSearch = null; } }
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; }
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); } }
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); }
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 (); }
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); }
void ReleaseDesignerOutlets () { if (MainSearchBar != null) { MainSearchBar.Dispose (); MainSearchBar = null; } }
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; }
public override void CancelButtonClicked (UISearchBar searchBar) { searchBar.ShowsCancelButton = false; searchBar.ResignFirstResponder (); searchBar.Text = string.Empty; _searchTextChanging.OnNext(searchBar.Text); }
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); }
public override void TextChanged (UISearchBar searchBar, string searchText) { if (this.searchController != null) { if (searchText.Length <= 0) { TCNotificationCenter.defaultCenter.postNotification (MConstants.kPostSearchBarEmpty, searchText); } } }
static UISearchBar CreateSearchBar () { UISearchBar search = new UISearchBar (); search.Placeholder = "Search Bing"; search.SizeToFit (); search.AutocorrectionType = UITextAutocorrectionType.No; search.AutocapitalizationType = UITextAutocapitalizationType.None; return search; }
public override void OnEditingStopped(UISearchBar searchbar) { var searchable = _Container.Root as ISearchBar; if (searchable != null && searchable.IncrementalSearch) { searchbar.ShowsCancelButton = false; _Container.FinishSearch(false); } }
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)); } }); }
public override void CancelButtonClicked(UISearchBar searchbar) { searchbar.ShowsCancelButton = false; searchbar.ResignFirstResponder(); new Wait(new TimeSpan(0,0,0,0,300), ()=> { _Container.FinishSearch(false); _Container.ToggleSearchbar(); }); }
public override void ViewDidLoad() { base.ViewDidLoad(); View.BackgroundColor = UIColor.White; TableView.AllowsSelection = true; TableView.AllowsMultipleSelection = false; TableView.SetCellStyle(UITableViewCellStyle.Subtitle); using (var set = new BindingSet<UITableView, CollectionBindingViewModel>(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 CGRect(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.SetCellBind(cell => { cell.SetEditingStyle(UITableViewCellEditingStyle.Delete); cell.Accessory = UITableViewCellAccessory.None; cell.DetailTextLabel.AdjustsFontSizeToFitWidth = true; using (var set = new BindingSet<CollectionItemModel>()) { set.Bind(cell, AttachedMembers.UITableViewCell.DeleteClickEvent) .To(() => (vm, ctx) => ctx.Relative<UIViewController>().DataContext<CollectionBindingViewModel>().RemoveCommand) .WithCommandParameter(() => (m, ctx) => ctx.Self().DataContext()) .ToggleEnabledState(false); set.Bind(cell, AttachedMembers.UITableViewCell.TitleForDeleteConfirmation) .To(() => (m, ctx) => string.Format("Delete {0} {1}", m.Name, m.Id)); set.Bind(cell.TextLabel).To(() => (m, ctx) => m.Name); set.Bind(cell.DetailTextLabel) .To(() => (m, ctx) => "Id " + m.Id); } }); }
public override void ViewDidLoad() { base.ViewDidLoad (); _searchBar = new UISearchBar(); View.AddSubview(_searchBar); View.SetStyleClass("sample-background"); _searchBar.SetStyleId("sample-search"); }
void ReleaseDesignerOutlets() { if (playerPickerView != null) { playerPickerView.Dispose (); playerPickerView = null; } if (playerSearchBar != null) { playerSearchBar.Dispose (); playerSearchBar = null; } }
/// <summary> /// Adds the search bar. /// </summary> private void AddSearchBar() { var height = this.NavigationController.NavigationBar.Frame.Height + UIApplication.SharedApplication.StatusBarFrame.Height; searchbar = new UISearchBar (new CGRect (0, height, this.CollectionView.Frame.Size.Width, 40)) { Placeholder = "search", ShowsCancelButton = true, Delegate = new SearchDelegate(this) }; this.View.AddSubview (searchbar); }
public override void ViewDidLoad () { base.ViewDidLoad (); Title = "Bing Search Example"; TableView.Source = new BingSource (this); _searchBar = CreateSearchBar (); _searchBar.SearchButtonClicked += OnSearchBarSearchButtonClicked; TableView.TableHeaderView = _searchBar; }
public static ObservableSearchDelegate AddSearchBar(this ReactiveTableViewController @this) { var searchBar = new UISearchBar(new RectangleF(0f, 0f, 320f, 44f)); searchBar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; var searchDelegate = new ObservableSearchDelegate(); searchBar.Delegate = searchDelegate; @this.TableView.TableHeaderView = searchBar; return searchDelegate; }
public void Include(UISearchBar searchBar) { searchBar.Text = "" + searchBar.Text; searchBar.TextChanged += (sender, e) => { searchBar.Text = string.Empty; };; }
private void SetupUserInterface() { var centerButtonX = View.Bounds.GetMidX() - 35f; var topLeftX = View.Bounds.X + 25; var topRightX = View.Bounds.Right - 65; var bottomButtonY = View.Bounds.Bottom - 150; var topButtonY = View.Bounds.Top + 15; var buttonWidth = 70; var buttonHeight = 70; var buttonX = View.Bounds.Width - 70; var buttonY = View.Bounds.Height / 3; search = new UISearchBar(); search.Frame = new CGRect(0, 0, View.Bounds.Width, 70); UIOffset offset = new UIOffset(); offset.Horizontal = 0; offset.Vertical = 10; search.SearchFieldBackgroundPositionAdjustment = offset; search.KeyboardType = UIKeyboardType.NumberPad; search.BackgroundColor = Color.FromHex(Constants.ColorPrimary).ToUIColor(); search.SearchBarStyle = UISearchBarStyle.Minimal; search.Placeholder = "Truy vấn mã sản phẩm"; search.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; search.BarTintColor = UIColor.White;//Color.FromHex(Constants.ColorSecondary).ToUIColor(); //search.color UIToolbar toolbar = new UIToolbar(new RectangleF(0.0f, 0.0f, 50.0f, 44.0f)); var doneButton = new UIBarButtonItem(UIBarButtonSystemItem.Done, delegate { search.ResignFirstResponder(); if (search.Text.Length != 0) { System.Diagnostics.Debug.WriteLine("text: " + search.Text); var newResultPage = new ResultPage(search.Text); Xamarin.Forms.Application.Current.MainPage.Navigation.PushAsync(newResultPage); } }); toolbar.Items = new UIBarButtonItem[] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), doneButton }; search.InputAccessoryView = toolbar; ScanButton = new UIButton(); ScanButton = UIButton.FromType(UIButtonType.Custom); System.Diagnostics.Debug.WriteLine(centerButtonX + "|" + bottomButtonY + "|" + buttonWidth + "|" + buttonHeight); ScanButton.SetImage(UIImage.FromFile("ic_scan_button_1.png"), UIControlState.Normal); ScanButton.Frame = new CGRect(buttonX, buttonY, buttonWidth, buttonHeight); tabControl = new TabController(); tabControl.View.TintColor = Color.FromHex(Constants.ColorPrimary).ToUIColor(); var napphsi = App.AppHSI.Count; Device.StartTimer(TimeSpan.FromSeconds(0.3), () => { if (App.AppHSI.Count != napphsi) { tabControl.reloaddata(); napphsi = App.AppHSI.Count; } return(true); // True = Repeat again, False = Stop the timer }); /* * var application = UIApplication.SharedApplication; * var statusBarView = application.ValueForKey(new NSString("statusBar")) as UIView; * var foregroundView = statusBarView.ValueForKey(new NSString("foregroundView")) as UIView; * * UIView dataNetworkItemView = null; * foreach (UIView subview in foregroundView.Subviews) * { * System.Diagnostics.Debug.WriteLine(subview.Class.Name+"\n"); * if ("UIStatusBarSignalStrengthItemView" == subview.Class.Name) * { * dataNetworkItemView = subview; * break; * } * } * if (null == dataNetworkItemView) * System.Diagnostics.Debug.WriteLine(" return false; //NO SERVICE"); * int bars2 = ((NSNumber)dataNetworkItemView.ValueForUndefinedKey(new NSString("signalStrengthBars"))).Int32Value; * int bars = ((NSNumber)dataNetworkItemView.ValueForKey(new NSString("signalStrengthBars"))).Int32Value; * System.Diagnostics.Debug.WriteLine("datanetwork "+ bars + " "+bars2);*/ tabControl.View.Frame = new CGRect(0, 70, View.Bounds.Width, View.Bounds.Height - 70); View.Add(tabControl.View); View.Add(search); View.AddSubview(ScanButton); }
public static void UpdateText(this UISearchBar uiSearchBar, SearchBar searchBar) { uiSearchBar.Text = TextTransformUtilites.GetTransformedText(searchBar.Text, searchBar.TextTransform); }
public override void ViewDidLoad() { base.ViewDidLoad(); View.BackgroundColor = UIColor.White; TableView.AllowsSelection = true; TableView.AllowsMultipleSelection = false; 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.SetCellBind(cell => { cell.SetEditingStyle(UITableViewCellEditingStyle.Delete); cell.Accessory = UITableViewCellAccessory.DetailDisclosureButton; cell.DetailTextLabel.AdjustsFontSizeToFitWidth = true; using (var set = new BindingSet <TableItemModel>()) { set.Bind(cell, AttachedMembers.UITableViewCell.AccessoryButtonTappedEvent) .To(() => (m, ctx) => ctx.Relative <UIViewController>().DataContext <TableViewModel>().ItemClickCommand) .OneTime() .WithCommandParameter(() => (m, ctx) => m) .ToggleEnabledState(false); set.Bind(cell, AttachedMembers.UITableViewCell.DeleteClickEvent) .To(() => (m, ctx) => ctx.Relative <UIViewController>().DataContext <TableViewModel>().RemoveCommand) .OneTime() .WithCommandParameter(() => (m, ctx) => m) .ToggleEnabledState(false); set.Bind(cell, AttachedMembers.UITableViewCell.TitleForDeleteConfirmation) .To(() => (m, ctx) => "Delete " + m.Name); set.Bind(cell, () => viewCell => viewCell.Selected).To(() => (m, ctx) => m.IsSelected).TwoWay(); set.Bind(cell, () => viewCell => viewCell.Highlighted).To(() => (m, ctx) => m.IsHighlighted).OneWayToSource(); set.Bind(cell, () => viewCell => viewCell.Editing).To(() => (m, ctx) => m.Editing).OneWayToSource(); set.Bind(cell.TextLabel).To(() => (m, ctx) => m.Name); set.Bind(cell.DetailTextLabel) .To(() => (m, ctx) => string.Format("Selected: {0}, Highlighted: {1}, Editing: {2}", m.IsSelected, m.IsHighlighted, m.Editing)); } }); }
public override void OnEditingStopped(UISearchBar searchBar) { searchBar.ShowsCancelButton = false; }
protected virtual void SetupSearchBar(UISearchBar searchBar) { searchBar.SetupStyle(ThemeConfig.ContentSearch.SearchBar); }
public override void TextChanged(UISearchBar searchBar, string searchText) { container.PerformFilter(searchText ?? ""); }
public override void OnEditingStopped(UISearchBar searchBar) { searchBar.ShowsCancelButton = false; container.FinishSearch(); }
public SearchDisplayControllerPoker(UISearchBar searchBar, UIViewController viewController) : base(searchBar, viewController) { }
public virtual void SearchButtonClicked(UISearchBar searchBar) { searchBar.ResignFirstResponder(); }
public override bool ShouldChangeTextInRange(UISearchBar searchBar, NSRange range, string text) { Console.WriteLine(searchBar.Text); return(true); }
public override void CancelButtonClicked(UISearchBar searchBar) { searchBar.ShowsCancelButton = false; container.FinishSearch(); searchBar.ResignFirstResponder(); }
public static string BindText(this UISearchBar uiSearchBar) => MvxTvosPropertyBinding.UISearchBar_Text;
public override void SearchButtonClicked(UISearchBar searchBar) { container.SearchButtonClicked(searchBar.Text); }
public void Include(UISearchBar searchBar) { searchBar.Text = searchBar.Text + ""; searchBar.Placeholder = searchBar.Placeholder + ""; searchBar.TextChanged += (s, e) => { }; }
public override void OnEditingStarted(UISearchBar searchBar) { searchBar.ShowsCancelButton = true; container.StartSearch(); }
public override void SearchButtonClicked(UISearchBar searchBar) { AppDataUtil.Instance.ContentSearchKeyword = searchBar.Text; NSNotificationCenter.DefaultCenter.PostNotificationName("SearchContentInIndex", this, new NSDictionary()); //searchBar.ResignFirstResponder (); }
public void SearchButtonClicked(UISearchBar searchBar) { SearchBar.ResignFirstResponder(); MapView.RemoveAnnotations(MapView.Annotations); PerformSearch(); }
public static void UpdateSearchBarStyle(this UISearchBar uiSearchBar, SearchBar searchBar) { uiSearchBar.SearchBarStyle = searchBar.OnThisPlatform().GetSearchBarStyle().ToPlatformSearchBarStyle(); }
public static void UpdateText(this UISearchBar uiSearchBar, ISearchBar searchBar) { uiSearchBar.Text = searchBar.Text; }
/// <summary> /// Apply this theme to a specific view. /// </summary> public static void Apply(UISearchBar view, string options = null) { view.TintColor = UIColor.DarkGray; }
public static void UpdateFont(this UISearchBar uiSearchBar, ISearchBar searchBar, IFontManager fontManager) { uiSearchBar.UpdateFont(searchBar, fontManager, null); }
public override void ViewDidLoad() { base.ViewDidLoad(); //Motor de busqueda UISearchBar i_search = new UISearchBar(); i_search.Frame = new CoreGraphics.CGRect(0, 65, 375, 44); i_search.TextChanged += delegate { //consulta en linq para verificar que el contenido de la busqueda este disponible try { LoadButtons(Loadlista(i_search.Text)); } catch (Exception ex) { } }; View.AddSubview(i_search); //categories UIButton btnFood = new UIButton(UIButtonType.Custom); btnFood.Frame = new CoreGraphics.CGRect(40, 115, 60, 60); btnFood.BackgroundColor = UIColor.White; btnFood.SetImage(UIImage.FromBundle("category/cutlery.png"), UIControlState.Normal); btnFood.TintColor = UIColor.White; btnFood.TouchUpInside += delegate { LoadButtons(Loadlista("comida")); }; UIButton btnCoffe = new UIButton(UIButtonType.Custom); btnCoffe.Frame = new CoreGraphics.CGRect(105, 115, 60, 60); btnCoffe.BackgroundColor = UIColor.White; btnCoffe.SetImage(UIImage.FromBundle("category/cup.png"), UIControlState.Normal); btnCoffe.TintColor = UIColor.White; btnCoffe.TouchUpInside += delegate { LoadButtons(Loadlista("cafe")); }; UIButton btnBar = new UIButton(UIButtonType.Custom); btnBar.Frame = new CoreGraphics.CGRect(170, 115, 60, 60); btnBar.BackgroundColor = UIColor.White; btnBar.SetImage(UIImage.FromBundle("category/pint.png"), UIControlState.Normal); btnBar.TintColor = UIColor.White; btnBar.TouchUpInside += delegate { LoadButtons(Loadlista("bar")); }; UIButton btnCinema = new UIButton(UIButtonType.Custom); btnCinema.Frame = new CoreGraphics.CGRect(240, 115, 60, 60); btnCinema.BackgroundColor = UIColor.White; btnCinema.SetImage(UIImage.FromBundle("category/video-camera.png"), UIControlState.Normal); btnCinema.TintColor = UIColor.White; btnCinema.TouchUpInside += delegate { LoadButtons(Loadlista("cinema")); }; View.Add(btnBar); View.Add(btnCoffe); View.Add(btnCinema); View.Add(btnFood); LoadButtons(Loadlista("comida")); //lista de lugares //valores de coordenadas }
public static void UpdatePlaceholder(this UISearchBar uiSearchBar, ISearchBar searchBar) { uiSearchBar.Placeholder = searchBar.Placeholder; }
/// <summary> /// Sets the title of the search bars cancel button /// </summary> /// <param name="searchBar"></param> /// <param name="cancelTitle"></param> public static void SetCancelTitle(this UISearchBar searchBar, string cancelTitle) { searchBar.GetCancelButton().SetTitle(cancelTitle, UIControlState.Normal); }
public override void SearchButtonClicked(UISearchBar searchBar) { _container.SearchButtonClicked(searchBar.Text); _container.NavigationController.SetNavigationBarHidden(false, true); }
public override void CancelButtonClicked(UISearchBar bar) { bar.ResignFirstResponder(); }
public override void TextChanged(UISearchBar searchBar, string searchText) { }
public override bool ShouldEndEditing(UISearchBar searchBar) { return(true); }
public static void SetTextColor(this UISearchBar bar, UIColor color) { bar.GetField().TextColor = color; }