Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

custom Datagrid column binding with Datagrid.ItemsSource

$
0
0

I have this class which which was generated by Linq to SQL class :

public partial class Meetlijn : INotifyPropertyChanging, INotifyPropertyChanged
	{
		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
		private int _MeetlijnID;
		private short _MeetstaatID;
		private System.Nullable<short> _Volgnummer;
		private string _Omschrving;
		private System.Nullable<short> _Aantal;
		private System.Nullable<short> _Stuk;
		private System.Nullable<float> _Lengte;
		private System.Nullable<float> _Breedte;
		private System.Nullable<float> _Hoogte;
		private System.Nullable<float> _Totaal;
		private EntityRef<Meetstaat> _Meetstaten;

ofcourse this class has its public properties.  I won't copy it because it would be to long.

I also have this list which is a collection of instances of the above class:

List<Meetlijnen> lstMl = new List<Meetlijnen>();

I want to use this list as a source for my Datagrid.ItemsSource, but I don't want to add all properties as columns (i.e. MeetstaatID don't have to be a column, because it's a database primary key identity and the user has no need for such information).

Is there a way I can use the ItemsSource property and customize the data to display in custom columns and setting the AutoGenerateColumns to false?

I do need the cells to automaticly change the values in the instances of "Meetlijn" in the list lstMl.

Thank you for the help.



Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>