WPF ListView Binding ItemsSource in XAML

前端 未结 2 1786
暗喜
暗喜 2021-01-01 14:57

I have a simple XAML page with a ListView on it defined like this


    
  • 2条回答
    •  醉梦人生
      2021-01-01 15:57

      Put this line after the existing code in xaml.cs

      this.DataContext = People;
      

      and replace your xaml with

      ItemsSource="{Binding People}" 
      

      to

      ItemsSource="{Binding}"
      

    提交回复
    热议问题