1

When I enable the Search bar on a DialogViewController, how is the searchbar's tint changed?

        EnableSearch = true;
        SearchPlaceholder = "Find station";
        AutoHideSearch = false;
Ian Vink
  • 66,960
  • 104
  • 341
  • 555

2 Answers2

3

The searchbar in MonoTouch.Dialog is private, you would need to modify your source code to change the TintColor when the searchBar is instantiated.

Another option suggested in the comments is to use:

((UISearchBar) TableView.TableHeaderView).TintColor = UIColor.Black;
miguel.de.icaza
  • 32,654
  • 6
  • 58
  • 76
  • Most excellent! May I suggest that you add this information as an answer to this post, so others looking for this information will find it. – miguel.de.icaza Dec 28 '11 at 13:13
  • The March 31, 2012 release broke this: See http://stackoverflow.com/questions/9969112/monotouch-dialog-uisearchbar-color – Ian Vink Apr 02 '12 at 16:57
0

Taking Miguel's help, I found that the TableHeaderView containers the SearchBar so I could do this to change the tint after the searchBar is instantiated (thanks):

UISearchBar sb = TableView.TableHeaderView as UISearchBar;
if(sb!=null)
   sb.TintColor = UIColor.Black;
Ian Vink
  • 66,960
  • 104
  • 341
  • 555