<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>BindingSource - A Closer Look...</title><link>http://blogs.msdn.com/dchandnani/archive/2005/03/15/396387.aspx</link><description>In my previous posts I have spoken about how databinding works in Whidbey and some simple scenarios of binding in Whidbey using BindingSource and BindingList&amp;lt;T&amp;gt;. Now, let’s take a closer look at the BindingSource. BindingSource can be bound to any</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: BindingSource - A Closer Look...</title><link>http://blogs.msdn.com/dchandnani/archive/2005/03/15/396387.aspx#396644</link><pubDate>Wed, 16 Mar 2005 11:17:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:396644</guid><dc:creator>mihailik</dc:creator><description>Excellent! I like this classes very much, I cannot wait Whidbey to be released :-)</description></item><item><title>re: BindingSource - A Closer Look...</title><link>http://blogs.msdn.com/dchandnani/archive/2005/03/15/396387.aspx#396914</link><pubDate>Wed, 16 Mar 2005 18:01:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:396914</guid><dc:creator>Dinesh Chandnani</dc:creator><description>Yes - these classes are really cool! &lt;br&gt;&lt;br&gt;One thing I should mention - though I mention DataTable in the section 'Binding to IList and IListSource', in reality, binding to a DataTable really behaves like Binding to IBindingListView. This is because a DataTable is an IListSource and it's getList method returns a DataView which is a IBindingListViewView. DataView is aware of all the changes to the DataTable i.e. row added/deleted/value changed/etc. So if you bind to a DataTable through a DataView you will see all the changes made to the DataTable since ListChanged events will be fired.&lt;br&gt;&lt;br&gt;Thanks,&lt;br&gt;-Dinesh</description></item><item><title>re: BindingSource - A Closer Look...</title><link>http://blogs.msdn.com/dchandnani/archive/2005/03/15/396387.aspx#401989</link><pubDate>Fri, 25 Mar 2005 00:21:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:401989</guid><dc:creator>Michael Weinhardt</dc:creator><description>Hi Dinesh,&lt;br&gt;&lt;br&gt;I'm wondering if this entry describes the features that will be available from the BindingSource, or that are available from the BindingSource.&lt;br&gt;&lt;br&gt;For example, I'm using the Feb CTP and, if I bind to IEnumerable from a DGV, via a BindingSource, I get a read-only DGV.&lt;br&gt;&lt;br&gt;Also, if I build a custom BindingList&amp;lt;T&amp;gt; that implements sorting, say, then set it as the BindingSource's data source using the designer eg&lt;br&gt;&lt;br&gt;public class MyDataSource : CustomBindingList&amp;lt;Person&amp;gt; {}&lt;br&gt;public class SortableBindingList&amp;lt;T&amp;gt; : BindingList&amp;lt;T&amp;gt; {&lt;br&gt;  //IBindingList sorting imp.&lt;br&gt;}&lt;br&gt;&lt;br&gt;this.bobBindingSource.DataSource = typeof(WindowsApplication1.bob)&lt;br&gt;&lt;br&gt;When it comes to running the app, the sorting disappears, suggesting a new BindingList is created in place of the one I thought I'd specified.&lt;br&gt;&lt;br&gt;Is the end goal to basically take any type and turn it into a BindingList (unless alreaedy one) as you suggest?&lt;br&gt;&lt;br&gt;Cheers,&lt;br&gt;Michael Weinhardt</description></item><item><title>re: BindingSource - A Closer Look...</title><link>http://blogs.msdn.com/dchandnani/archive/2005/03/15/396387.aspx#402081</link><pubDate>Fri, 25 Mar 2005 05:38:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:402081</guid><dc:creator>Dinesh Chandnani</dc:creator><description>Hello Michael,&lt;br&gt;&lt;br&gt;These features are currently available in BindingSource.&lt;br&gt;&lt;br&gt;When you bind IEnumerable to a BindingSource whioch is bound to a DGV, BindingSource basically checks to see if the object in the list has a default public constructor. If it does, then it will allow new objects to be added in the list and the DGV will thus be read/write. However, if the object does not have a public default constructor then the BindingSource cannot add new objects to the list and so the DGV will end up being read-only. So, you will have to add a public default constructor to the object to have a read-write DGV.&lt;br&gt;&lt;br&gt;When you bind to a BindingSource by specifying a type, yes, the BindingSource creates a BindingList&amp;lt;T&amp;gt; internally of the type specified. So in the case above, BindingSource created BindingList&amp;lt;typeof(WindowsApplication1.bob)&amp;gt;. If you want to allow sorting you can set the datasource of BindingSource to be the SortableBindingList&amp;lt;T&amp;gt;.&lt;br&gt;&lt;br&gt;SortableBindingList&amp;lt;Customer&amp;gt; sbList = new SortableBindingList&amp;lt;Customer&amp;gt;();&lt;br&gt;this.bindingSource.DataSource = sbList; // Now sorting will work fine&lt;br&gt;&lt;br&gt;So, if the DataSource is an IList, IListSource, IBindingList or IBindingListView, the BindingSource will not create an internal BindingList&amp;lt;T&amp;gt;. &lt;br&gt;&lt;br&gt;So end goal is to turn it into a BindingList if it is anything &amp;quot;lesser&amp;quot; than an IList, or to keep it as IList or IListSource if it is one of these already.&lt;br&gt;&lt;br&gt;Please let me know if you have any more questions.&lt;br&gt;&lt;br&gt;Thanks,&lt;br&gt;-Dinesh Chandnani&lt;br&gt;</description></item><item><title>re: BindingSource - A Closer Look...</title><link>http://blogs.msdn.com/dchandnani/archive/2005/03/15/396387.aspx#402858</link><pubDate>Mon, 28 Mar 2005 08:42:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:402858</guid><dc:creator>Michael Weinhardt</dc:creator><description>Hi Dinesh,&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;I don't see the IEnumerable behavior you are describing ie it remains read-only when bound to a DGV via a BindingSource eg:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;  public class Person {&amp;lt;br&amp;gt;    public string Name { ... }&amp;lt;br&amp;gt;    public int Age { ... }&amp;lt;br&amp;gt;  }&amp;lt;br&amp;gt;  public class Persons : IEnumerable { ... }&amp;lt;br&amp;gt;  public partial class Form1 : Form {&amp;lt;br&amp;gt;    public Form1() {&amp;lt;br&amp;gt;      InitializeComponent();&amp;lt;br&amp;gt;      Persons persons = new Persons();&amp;lt;br&amp;gt;      BindingSource bs = new BindingSource(persons, null);&amp;lt;br&amp;gt;      this.dataGridView1.DataSource = bs;&amp;lt;br&amp;gt;    }&amp;lt;br&amp;gt;  }&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;Also, why is there are difference between me setting a BindingSource's data source using the designer (BindingSource.DataSource = typeof(mySortableType); vs run-time (BindingSource.DataSource = new mySortabletype();. What I mean by that is, if I can set the BindingSource with a DataSource that provides sorting, from the designer, I expect the sorting to be retained when run. I don't expect to have to write additional code to, essentially, reseed the BindingSource with the desired data source.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;BTW I actually love the BindingSource and the Data Binding improvements, but the design-time/run-time differences concern me. What am I missing?&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;Thanks Dinesh!&amp;lt;br&amp;gt;Michael</description></item><item><title>Details of .NET 2.0 Data Binding</title><link>http://blogs.msdn.com/dchandnani/archive/2005/03/15/396387.aspx#416712</link><pubDate>Thu, 12 May 2005 05:12:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:416712</guid><dc:creator>Bat's Blog</dc:creator><description>Found a blog of one of the developers that works in the .NET Client&lt;br&gt;Team which is responsible for the...</description></item><item><title>re: BindingSource - A Closer Look...</title><link>http://blogs.msdn.com/dchandnani/archive/2005/03/15/396387.aspx#451572</link><pubDate>Sun, 14 Aug 2005 21:09:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:451572</guid><dc:creator>dchandnani</dc:creator><description>In case of IEnumerable, you will need to set AllowNew property of BindingSource to true. Please let me know of any questions.&lt;br&gt;&lt;br&gt;Regards,&lt;br&gt;-Dinesh Chandnani</description></item><item><title>Databinding in .Net Win Forms</title><link>http://blogs.msdn.com/dchandnani/archive/2005/03/15/396387.aspx#528100</link><pubDate>Thu, 09 Feb 2006 03:51:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:528100</guid><dc:creator>SimonS</dc:creator><description>I&amp;amp;amp;rsquo;m building a little app at the moment to leanr some winforms stuff. I have done this in the past...</description></item><item><title>Databinding in .Net Win Forms</title><link>http://blogs.msdn.com/dchandnani/archive/2005/03/15/396387.aspx#528120</link><pubDate>Thu, 09 Feb 2006 03:54:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:528120</guid><dc:creator>SimonS</dc:creator><description>I&amp;amp;amp;rsquo;m building a little app at the moment to leanr some winforms stuff. I have done this in the past...</description></item><item><title>Databinding in .Net Win Forms</title><link>http://blogs.msdn.com/dchandnani/archive/2005/03/15/396387.aspx#604596</link><pubDate>Tue, 23 May 2006 12:15:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:604596</guid><dc:creator>SimonS' SQL Server Stuff</dc:creator><description>I&amp;amp;amp;rsquo;m building a little app at the moment to leanr some winforms stuff. I have done this in the past...</description></item><item><title>Databinding in .Net Win Forms</title><link>http://blogs.msdn.com/dchandnani/archive/2005/03/15/396387.aspx#3068043</link><pubDate>Sun, 03 Jun 2007 23:45:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3068043</guid><dc:creator>SimonS SQL Server Stuff</dc:creator><description>&lt;p&gt;I&amp;amp;rsquo;m building a little app at the moment to leanr some winforms stuff. I have done this in the past&lt;/p&gt;
</description></item><item><title>An alternative to data binding</title><link>http://blogs.msdn.com/dchandnani/archive/2005/03/15/396387.aspx#5860455</link><pubDate>Sat, 03 Nov 2007 17:57:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5860455</guid><dc:creator>rabidhamster1971</dc:creator><description>&lt;p&gt;You might be interested in this alternative to data binding. It automatically responds to changes in your own data stuctures without requiring a bindingsource. You handle events on the controls that call your own business logic. When the underlying data changes, the controls fire the events again and update themselves automatically.&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://updatecontrols.net"&gt;http://updatecontrols.net&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>Infragistics Tips and Tricks - Part 1 of N</title><link>http://blogs.msdn.com/dchandnani/archive/2005/03/15/396387.aspx#8345560</link><pubDate>Mon, 31 Mar 2008 15:52:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8345560</guid><dc:creator>Dan's  Blog</dc:creator><description>&lt;p&gt;The current project I'm on is using Infragistics controls exclusively.&amp;amp;#160; Infragistics can do some&lt;/p&gt;
</description></item><item><title>Databinding Basics &amp;laquo; Rams On It - .NET</title><link>http://blogs.msdn.com/dchandnani/archive/2005/03/15/396387.aspx#8447877</link><pubDate>Fri, 02 May 2008 02:35:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8447877</guid><dc:creator>Databinding Basics &amp;laquo; Rams On It - .NET</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://ramsonit.wordpress.com/2008/05/01/databinding-basics/"&gt;http://ramsonit.wordpress.com/2008/05/01/databinding-basics/&lt;/a&gt;&lt;/p&gt;
</description></item><item><title> DC s Net Client Blogs BindingSource A Closer Look | Cellulite Creams</title><link>http://blogs.msdn.com/dchandnani/archive/2005/03/15/396387.aspx#9720504</link><pubDate>Wed, 10 Jun 2009 04:31:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9720504</guid><dc:creator> DC s Net Client Blogs BindingSource A Closer Look | Cellulite Creams</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://cellulitecreamsite.info/story.php?id=798"&gt;http://cellulitecreamsite.info/story.php?id=798&lt;/a&gt;&lt;/p&gt;
</description></item></channel></rss>