WPF: Setting ItemSource in XAML vs. code-behind

前端 未结 2 1906
长发绾君心
长发绾君心 2021-01-12 08:37

Since this is WPF, it may look like lots of code, but don\'t be frightened, the question is really simple!

I have the following XAML:



        
2条回答
  •  甜味超标
    2021-01-12 09:38

    When you bind to a datasource in WPF, it is looking for a property of your Window's data context called "AllRoles". Check out the Model-View-ViewModel pattern for more on data binding in xaml. http://msdn.microsoft.com/en-us/magazine/dd419663.aspx

提交回复
热议问题