I’m using MT.D to list out staff in a DialogViewController. EnableSearch is on and you can filter items that are in the list. However, if you push to another view, then come back, the search bar is empty. I was able to get it to restore the search query used by overriding OnSearchTextChanged (string text) and storing the string to a local field, and when the view comes back into focus, I use the following code:
public override ViewDidAppear (bool animated)
{
base.ViewDidAppear (animated);
if (EnableSearch && !string.IsNullOrWhiteSpace (lastSearchQuery))
{
this.SearchButtonClicked (lastSearchQuery); // this inserts text
this.StartSearch (); // no clue what this is doing
this.ReloadData (); // does nothing but was worth a try
}
}
That code inserts the text into the search bar and shows it, but I can’t get it to filter unless you type something. The keyboard is brought into view and there is a search button but it does nothing. Any suggestions?
I think all you are missing is a call to PerformFilter on the DialogViewController.
I typed up a quick sample to show the behavior. I never did see the exact behavior you observed. I did not have to repopulate the search field. For reference I am using Monotouch 5.2.11.