private void UpdateShelfContentInfo(Page page, SortOrderFunction order, SortDirection direction) { Info.Text = null; Info.From = null; Info.To = null; if (page.Hits.Count > 0) { if (order.EnumValue == SortOrder.relevance) { Info.Text = HBS.Search.SearchText; } else { //get first and last valid value var first = page.Hits.FirstOrDefault(hit => order.HasProperty(hit)); var last = page.Hits.LastOrDefault(hit => order.HasProperty(hit)); //get string representatives var firstString = ""; if (first != null) { firstString = order.GetRepresentative(first); } var lastString = ""; if (last != null) { lastString = order.GetRepresentative(last); } //set info properties Info.From = firstString; Info.To = lastString; } } IsInfoVisible = !string.IsNullOrEmpty(Info.From) || !string.IsNullOrEmpty(Info.To); }