Next, you can define an array in your XAML then set that as your ItemsSource on your ListView. Then you use the DisplayMemberBinding property of each GridViewColumn to decide what you want to display in each column:
Also, I highly recommend downloading the WPF Toolkit to use the DataGrid rather than the ListView. The DataGrid makes customizing visuals much easier. I believe it also has some additional options for sizing columns (percent, auto, etc.). You might also look at this quick stack overflow discussion of the advantages of using DataGrid.
I am making use of a DataForm to display my data. I have made use of the DataForm edit template to customize the layout of the form. Data is returned and is being displayed within the DataForm. The problem is that, as soon as I start navigating (2 navigation clicks) with the DataFrom, only the ComboBox 'looses' it's binding on the SelectedItem (although it's selected item was data bound and then it just goes blank ).
The back end code consists of a generic list List<string> and a string variable that has the value of each data item that is returned.
Hey. This problem has been bugging me a lot lately - Something really odd is happening in the framework. What's happening is the data field control is modifying the bindings on the control and re-setting them. Setting the SelectedItem works fine, but when it comes to re-set the ItemsSource property the binding for the *SelectedItem* property *vanishes* without a trace.
The only workaround I have at the moment is to make the ItemsSource binding TwoWay, and ensuring that the property it's bound to is read-only. This stops the code from modifying the ItemsSource binding.
However, I'm now finding that the bindings are disappearing under other circumstances as well (it looks like it's happening occasionally when there is more than 1 combo box in the form) - I haven't solved that one yet.
Last Visit: 31-Dec-99 19:00 Last Update: 3-Dec-23 11:59