dotnet / dotnet-api-docs

.NET API reference documentation (.NET 5+, .NET Core, .NET Framework)
https://docs.microsoft.com/dotnet/api/
Other
738 stars 1.57k forks source link

Incomplete sample of WPF ListView class #825

Open SimpleSamples opened 6 years ago

SimpleSamples commented 6 years ago

The sample code is typical of XAML/WPF samples. It is extremely, extremely frustrating. It does not show what EmployeeInfoDataSource is. It is so frustrating because there are so many ways of doing data binding and nearly always the actual definition and declaration of the data is not shown so it is very difficult to know what applies to what.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

rpetrusha commented 6 years ago

Thanks for pointing this out, @SimpleSamples. Unfortunately, it's true that many of our WPF samples lack context and provide only incomplete code. We've addressed this issue for a different topic in #6806 by including the entire windows1.xaml file and highlighting its relevant portions, but here we'll have to include the definition of the EmployeeInfo and myEmployees classes from windows1.xaml.cs as well as the windows1.xaml file.

I've added this to our backlog, made it up-for-grabs, and added it to the community contributors project.

SimpleSamples commented 6 years ago

I do not know where the new version of the following is but it is the most important place for the explanation to be. It however shows a ListBox and then it leaves the simply binding behind and goes off to animation and shock and awe stuff. The more practical topic (for many businesses) of grids like ListView and DataGrid is not so easy to find.

https://msdn.microsoft.com/en-us/library/ms752347(v=vs.100).aspx?f=255&MSPPError=-2147217396

After trial and error I managed to get ItemsSource in code to work combined with DisplayMemberBinding in XAML for a ListView but it is difficult to find complete simple samples of things like that. The introduction should at least make that type of thing easier.