Ejemplo n.º 1
0
        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 ();
        }
Ejemplo n.º 2
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			
			NavigationItem.Title = "Search Bar Example";
			
			// load our dictonary words
			LoadWords();
			
			// create our table source and bind it to the table
			tableSource = new WordsTableSource();
			tblMain.Source = tableSource;
			
			// wire up the search button clicked handler to hide the keyboard
			srchMain.SearchButtonClicked += (s, e) => { srchMain.ResignFirstResponder(); };
			
			// refine the search results every time the text changes
			srchMain.TextChanged += (s, e) => { RefineSearchItems(); };
		}
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            this.NavigationItem.Title = "Search Bar Example";

            //---- load our dictonary words
            this.LoadWords();

            //---- create our table source and bind it to the table
            this._tableSource   = new WordsTableSource();
            this.tblMain.Source = this._tableSource;

            //---- wire up the search button clicked handler to hide the keyboard
            this.srchMain.SearchButtonClicked += (s, e) => { srchMain.ResignFirstResponder(); };

            //---- refine the search results every time the text changes
            this.srchMain.TextChanged += (s, e) => { this.RefineSearchItems(); };
        }
Ejemplo n.º 4
0
 /// <summary>
 /// This loads our dictionary of words into our _dictionary object.
 /// </summary>
 protected void LoadWords()
 {
     var doc = XDocument.Load ("Content/EntryList.xml");
     _dictionary = doc.Descendants ("Entry")
         .Select (o => new Entry
         {
             Acronym = (string)o.Attribute("Acronym"),
             AcronymLower = o.Attribute("Acronym").ToString().ToLower(),
             Description = (string)o.Attribute("Description")
         }).ToList ();
     // create our table source and bind it to the table
     _tableSource = new WordsTableSource(this);
     tblMain.Source = _tableSource;
     _tableSource.Words = _dictionary.ToList();
     tblMain.ReloadData();
 }