ListView.GroupShortNameBinding プロパティ

定義

グループ化されたジャンプ リストに表示する名前用のバインディングを取得または設定します。

public Xamarin.Forms.BindingBase GroupShortNameBinding { get; set; }
member this.GroupShortNameBinding : Xamarin.Forms.BindingBase with get, set

プロパティ値

BindingBase

グループ化された BindingBase リストに適用するインスタンス、または null

次の例では、最初の最初に短い名前のバインドセットを使用してグループ化された、ひとのアルファベット順の一覧を示します。

class Person
{
  public string FullName
  {
    get;
    set;
  }

  public string Address
  {
    get;
    set;
  }
}
class Group : ObservableCollection<Person>
{
  public Group (string firstInitial)
  {
    FirstInitial = firstInitial;
  }

  public string FirstInitial
  {
    get;
    private set;
  }
}
ListView CreateListView()
{
  var listView = new ListView {
    IsGroupingEnabled = true,
    GroupDisplayBinding = new Binding ("FirstInitial"),
    GroupShortNameBinding = new Binding ("FirstInitial")
  };

  var template = new DataTemplate (typeof (TextCell));
  template.SetBinding (TextCell.TextProperty, "FullName");
  template.SetBinding (TextCell.DetailProperty, "Address");

  itemsView.ItemTemplate = template;
  itemsView.ItemsSource = new[] {
        new Group ("C") {
            new Person { FullName = "Caprice Nave" }
        },

    new Group ("J") {
            new Person { FullName = "James Smith", Address = "404 Nowhere Street" },
            new Person { FullName = "John Doe", Address = "404 Nowhere Ave" }
        }
  };
}

注釈

で項目をグループ化する場合、多くの場合、 ListView リスト内の特定のセクションにジャンプするジャンプリストを作成すると便利です。 たとえば、アルファベット順にグループ化されたリストの場合、ジャンプリストは各グループの文字になります。 このバインドは、各グループのに対して適用され、 IEnumerable ジャンプリストに表示する短い名前を選択します。

注: Android では、ジャンプリストが表示されません。

適用対象