Bind to Count of items in the DataContext

后端 未结 5 1244
别跟我提以往
别跟我提以往 2021-02-12 03:45

I want to bind to the Count/amount of items within my DataContext.

I have an object, lets say person which has a List

as a property. I would
5条回答
  •  日久生厌
    2021-02-12 04:02

    You need to bind the name of the property, not its type.

    C#:

    public class Person
    {
        ...
        public List
    Addresses { get; set; } ... }

    XAML:

    {Binding Addresses.Count}
    

    Assuming your DataContext is an object of type Person.

提交回复
热议问题