我是xamarin表单的新手,我想在列表中添加跳转列表功能,该如何实现。
这是我的代码
_realmList = _tmpList.OrderBy(s => s.ProjectName).Select(s => new ProjectNameDataRealm
{
jumpList = s.ProjectName.First(),
CongressionalDistrict = s.CongressionalDistrict,
Project_ID = s.Project_ID,
StateshortName = s.StateshortName,
ShortProjectname = s.ProjectName.Length > 12 ? s.ProjectName.Remove(12) + "..." : s.ProjectName,
ProjectName = s.ProjectName,
streetAddress = s.streetAddress,
city = s.city,
latitude = s.latitude,
longitude = s.longitude,
MarketType = s.MarketType,
PopulationServedTypeListName = s.PopulationServedTypeListName,
ProjectClosingDate = s.ProjectClosingDate,
Sponsor = s.Sponsor,
Distance = 0,
Time = "-",
ProjectImg = "loading",
ZipCode = s.ZipCode,
projectDescription = string.IsNullOrEmpty(s.projectDescription) ? "-" : s.projectDescription,
UnitCount = s.UnitCount != null ? s.UnitCount.Value : 0,
QODate = s.QODate,
PermLoanLender1 = s.PermLoanLender1,
LimitedPartnershipName = s.LimitedPartnershipName,
DeveloperCost = s.DeveloperCost,
// StackWidth = s.streetAddress.Length > 21 ? 50 : 0,
}).ToObservableCollection();
GroupedData = _realmList.OrderBy(p => p.ProjectName)
.GroupBy(p => p.ProjectName[0].ToString())
.Select(p => new ObservableGroupCollection<string, ProjectNameDataRealm>(p)).ToList();
if (_realmList.Any())
{
if (Device.RuntimePlatform == Device.Android)
{
lv_searchDroid.ItemsSource = GroupedData ;
lv_searchDroid.IsGroupingEnabled = true;
lv_searchDroid.GroupShortNameBinding = new Binding("Key");
BindingContext = this;
}
}
我想按项目名称对列表进行分组,并在右侧显示第一个字母。
但是上面的代码对我不起作用。
我想显示这样的跳转列表
请帮助我...我为此感到挣扎。