<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: ItemsControl:  &#039;E&#039; is for Editable Collection</title>
	<atom:link href="http://drwpf.com/blog/2008/10/20/itemscontrol-e-is-for-editable-collection/feed/" rel="self" type="application/rss+xml" />
	<link>http://drwpf.com/blog/2008/10/20/itemscontrol-e-is-for-editable-collection/</link>
	<description>Drinking (and serving) the WPF Kool-Aid since 2002</description>
	<lastBuildDate>Fri, 05 Mar 2010 02:30:52 -0600</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Fahad</title>
		<link>http://drwpf.com/blog/2008/10/20/itemscontrol-e-is-for-editable-collection/comment-page-1/#comment-402</link>
		<dc:creator>Fahad</dc:creator>
		<pubDate>Mon, 03 Aug 2009 22:26:55 +0000</pubDate>
		<guid isPermaLink="false">http://drwpf.com/blog/?p=42#comment-402</guid>
		<description>Was just going thru your blog, You can refresh a single item by doing the following,&lt;br&gt;&lt;br&gt;- implement INotifyPropertyChanged in the business object.&lt;br&gt;- before the ItemsSource is set, loop thru all the items and tag the PropertyChanged event,&lt;br&gt;&lt;br&gt;northwind.Orders.ForEach&lt;Order&gt;(o=&gt;{&lt;br&gt; o.PropertyChanged += (s,e)=&gt;{&lt;br&gt; var changedItem = s as Order;&lt;br&gt; orders[orders.IndexOf(changedItem)] = changedItem;&lt;br&gt; };&lt;br&gt;});&lt;br&gt;&lt;br&gt;- Above code is not very well written, but that should be it. The CollectionView has a INotifyCollectionChanged interface implemented, this will trigger with &quot;e.Action == NotifyChangedAction.Replace&quot; event, if the control listens to this action and refreshes the UI internally, then this should work well.&lt;br&gt;&lt;br&gt;Check it out!!!</description>
		<content:encoded><![CDATA[<p>Was just going thru your blog, You can refresh a single item by doing the following,</p>
<p>- implement INotifyPropertyChanged in the business object.<br />- before the ItemsSource is set, loop thru all the items and tag the PropertyChanged event,</p>
<p>northwind.Orders.ForEach<order>(o=>{<br /> o.PropertyChanged += (s,e)=>{<br /> var changedItem = s as Order;<br /> orders[orders.IndexOf(changedItem)] = changedItem;<br /> };<br />});</p>
<p>- Above code is not very well written, but that should be it. The CollectionView has a INotifyCollectionChanged interface implemented, this will trigger with &#8220;e.Action == NotifyChangedAction.Replace&#8221; event, if the control listens to this action and refreshes the UI internally, then this should work well.</p>
<p>Check it out!!!</order></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daryl</title>
		<link>http://drwpf.com/blog/2008/10/20/itemscontrol-e-is-for-editable-collection/comment-page-1/#comment-401</link>
		<dc:creator>Daryl</dc:creator>
		<pubDate>Wed, 22 Jul 2009 19:43:48 +0000</pubDate>
		<guid isPermaLink="false">http://drwpf.com/blog/?p=42#comment-401</guid>
		<description>The real solution here is to have the various CollectionView classes monitor INotifyPropertyChanged events, re-sorting and grouping and filtering as appropriate. I don&#039;t understand why this isn&#039;t being done.&lt;br&gt;&lt;br&gt;If a view is sorted on &quot;DOB&quot;, and a PropertyChanged event notifies you that an item&#039;s &quot;DOB&quot; property was modified, it stands to reason that the view should be re-sorted. Same for grouping and filtering.&lt;br&gt;&lt;br&gt;It would be easier to get this done if C# had first-class support for weak events. The current &quot;WeakEventManager&quot; approach is a lot of code and static class overhead every time you just want to implement the Observer pattern. Any clue if this is ever going to happen, Doc?</description>
		<content:encoded><![CDATA[<p>The real solution here is to have the various CollectionView classes monitor INotifyPropertyChanged events, re-sorting and grouping and filtering as appropriate. I don&#8217;t understand why this isn&#8217;t being done.</p>
<p>If a view is sorted on &#8220;DOB&#8221;, and a PropertyChanged event notifies you that an item&#8217;s &#8220;DOB&#8221; property was modified, it stands to reason that the view should be re-sorted. Same for grouping and filtering.</p>
<p>It would be easier to get this done if C# had first-class support for weak events. The current &#8220;WeakEventManager&#8221; approach is a lot of code and static class overhead every time you just want to implement the Observer pattern. Any clue if this is ever going to happen, Doc?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Nelson</title>
		<link>http://drwpf.com/blog/2008/10/20/itemscontrol-e-is-for-editable-collection/comment-page-1/#comment-400</link>
		<dc:creator>David Nelson</dc:creator>
		<pubDate>Mon, 08 Jun 2009 20:29:37 +0000</pubDate>
		<guid isPermaLink="false">http://drwpf.com/blog/?p=42#comment-400</guid>
		<description>IEditableCollectionView and IEditableObject are only present to support transactional updates. What I describe in this article is merely a hack...&lt;br&gt;&lt;br&gt;Fair enough. I have been struggling this problem for quite a while now; I was hoping this would finally provide a solution that wouldn&#039;t require enormous amounts of custom code. But it looks like I am going to have to go back to writing my own filter/sort collection, essentially re-creating all of the functionality in ListCollectionView, because the framework version is missing one very small extensibility point.&lt;br&gt;&lt;br&gt;It&#039;s just very strange to me that this problem wasn&#039;t addressed in the first round of WPF design, much less the second or the third. It seems to me to be an extremely common scenario: change an item and have that item updated accordingly, wherever it may be. Isn&#039;t that the whole point of databinding in the first place? Although I suppose that everyone thinks that their own problems are common scenarios...</description>
		<content:encoded><![CDATA[<p>IEditableCollectionView and IEditableObject are only present to support transactional updates. What I describe in this article is merely a hack&#8230;</p>
<p>Fair enough. I have been struggling this problem for quite a while now; I was hoping this would finally provide a solution that wouldn&#8217;t require enormous amounts of custom code. But it looks like I am going to have to go back to writing my own filter/sort collection, essentially re-creating all of the functionality in ListCollectionView, because the framework version is missing one very small extensibility point.</p>
<p>It&#8217;s just very strange to me that this problem wasn&#8217;t addressed in the first round of WPF design, much less the second or the third. It seems to me to be an extremely common scenario: change an item and have that item updated accordingly, wherever it may be. Isn&#8217;t that the whole point of databinding in the first place? Although I suppose that everyone thinks that their own problems are common scenarios&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dr. WPF</title>
		<link>http://drwpf.com/blog/2008/10/20/itemscontrol-e-is-for-editable-collection/comment-page-1/#comment-399</link>
		<dc:creator>Dr. WPF</dc:creator>
		<pubDate>Fri, 29 May 2009 00:15:50 +0000</pubDate>
		<guid isPermaLink="false">http://drwpf.com/blog/?p=42#comment-399</guid>
		<description>Just to be clear, David... the WPF team did *not* provide IEditableCollectionView as a mechanism to solve the problem of refreshing a single item. IEditableCollectionView and IEditableObject are only present to support transactional updates.&lt;br&gt;&lt;br&gt;What I describe in this article is merely a hack that leverages this new feature to allow the refreshing of a single item. Prior to IEditableCollectionView, this was not even possible.&lt;br&gt;&lt;br&gt;I agree that it would be nice to see a method that allows a single item to be manually refreshed within a collection view. I&#039;ve requested this before and I know others have too. There are definitely changes coming for WPF 4.0 in this area, but I don&#039;t know if this particular feature was added. I&#039;ll take a look when I have some bandwidth and post back here.</description>
		<content:encoded><![CDATA[<p>Just to be clear, David&#8230; the WPF team did *not* provide IEditableCollectionView as a mechanism to solve the problem of refreshing a single item. IEditableCollectionView and IEditableObject are only present to support transactional updates.</p>
<p>What I describe in this article is merely a hack that leverages this new feature to allow the refreshing of a single item. Prior to IEditableCollectionView, this was not even possible.</p>
<p>I agree that it would be nice to see a method that allows a single item to be manually refreshed within a collection view. I&#8217;ve requested this before and I know others have too. There are definitely changes coming for WPF 4.0 in this area, but I don&#8217;t know if this particular feature was added. I&#8217;ll take a look when I have some bandwidth and post back here.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: david@commongenius.com</title>
		<link>http://drwpf.com/blog/2008/10/20/itemscontrol-e-is-for-editable-collection/comment-page-1/#comment-398</link>
		<dc:creator>david@commongenius.com</dc:creator>
		<pubDate>Thu, 28 May 2009 21:29:42 +0000</pubDate>
		<guid isPermaLink="false">http://drwpf.com/blog/?p=42#comment-398</guid>
		<description>I have finally been able to install SP1, and after taking a closer look at IEditableCollectionView, I have come to the conclusion that it really doesn&#039;t help me any.&lt;br&gt;&lt;br&gt;Objects are being update asynchronously inside the model. The model does not necessarily know all of the collections of which the object may be a member, since those collections only exist in the presentation. So there is no way for EditItem to be called in advance of the edit.&lt;br&gt;&lt;br&gt;Combine that with Justin&#039;s point about items that are not yet a part of the collection, and it really seems like the WPF team took the completely wrong approach to solving this problem. IEditableCollectionView and the corresponding implementations in CollectionView and ItemCollection only address certain very narrow use cases. It seems like providing a Refresh(item) method (that works for any item from the underlying collection) would have been a much simpler and much more broadly applicable solution.</description>
		<content:encoded><![CDATA[<p>I have finally been able to install SP1, and after taking a closer look at IEditableCollectionView, I have come to the conclusion that it really doesn&#8217;t help me any.</p>
<p>Objects are being update asynchronously inside the model. The model does not necessarily know all of the collections of which the object may be a member, since those collections only exist in the presentation. So there is no way for EditItem to be called in advance of the edit.</p>
<p>Combine that with Justin&#8217;s point about items that are not yet a part of the collection, and it really seems like the WPF team took the completely wrong approach to solving this problem. IEditableCollectionView and the corresponding implementations in CollectionView and ItemCollection only address certain very narrow use cases. It seems like providing a Refresh(item) method (that works for any item from the underlying collection) would have been a much simpler and much more broadly applicable solution.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Seema</title>
		<link>http://drwpf.com/blog/2008/10/20/itemscontrol-e-is-for-editable-collection/comment-page-1/#comment-397</link>
		<dc:creator>Seema</dc:creator>
		<pubDate>Wed, 22 Apr 2009 08:51:15 +0000</pubDate>
		<guid isPermaLink="false">http://drwpf.com/blog/?p=42#comment-397</guid>
		<description>This is really amazing, could not find more helpful information on ItemsControls. Continue with the series..looking forward for it till Z.</description>
		<content:encoded><![CDATA[<p>This is really amazing, could not find more helpful information on ItemsControls. Continue with the series..looking forward for it till Z.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Trey</title>
		<link>http://drwpf.com/blog/2008/10/20/itemscontrol-e-is-for-editable-collection/comment-page-1/#comment-396</link>
		<dc:creator>Trey</dc:creator>
		<pubDate>Thu, 02 Apr 2009 22:52:40 +0000</pubDate>
		<guid isPermaLink="false">http://drwpf.com/blog/?p=42#comment-396</guid>
		<description>Very helpful. My apologies for posting about my situation on the first CollectionView lesson... it is likely more relevant to this one as it pertains specifically to IEditableCollectionView and bound EntityObjects as ItemsSource.</description>
		<content:encoded><![CDATA[<p>Very helpful. My apologies for posting about my situation on the first CollectionView lesson&#8230; it is likely more relevant to this one as it pertains specifically to IEditableCollectionView and bound EntityObjects as ItemsSource.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dr. WPF</title>
		<link>http://drwpf.com/blog/2008/10/20/itemscontrol-e-is-for-editable-collection/comment-page-1/#comment-394</link>
		<dc:creator>Dr. WPF</dc:creator>
		<pubDate>Tue, 03 Mar 2009 01:17:17 +0000</pubDate>
		<guid isPermaLink="false">http://drwpf.com/blog/?p=42#comment-394</guid>
		<description>SIGHHHhhh...&lt;br&gt;&lt;br&gt;Yes, Justin, that is a drawback to leveraging IEditableCollectionView to cause an item to be updated in the view.... namely, the item must already belong to the view. I *totally* feel your pain here. I have the same scenario in an app and the only option is to refresh the entire view (or remove/readd the item, as you suggest).&lt;br&gt;&lt;br&gt;The framework developers probably did not anticipate folks using EditItem/CommitItem to update a view like this. I am going to request that they add a specific method to ICollectionView for updating a single item in the view.&lt;br&gt;&lt;br&gt;Cheers,&lt;br&gt;-dw</description>
		<content:encoded><![CDATA[<p>SIGHHHhhh&#8230;</p>
<p>Yes, Justin, that is a drawback to leveraging IEditableCollectionView to cause an item to be updated in the view&#8230;. namely, the item must already belong to the view. I *totally* feel your pain here. I have the same scenario in an app and the only option is to refresh the entire view (or remove/readd the item, as you suggest).</p>
<p>The framework developers probably did not anticipate folks using EditItem/CommitItem to update a view like this. I am going to request that they add a specific method to ICollectionView for updating a single item in the view.</p>
<p>Cheers,<br />-dw</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Justin Case</title>
		<link>http://drwpf.com/blog/2008/10/20/itemscontrol-e-is-for-editable-collection/comment-page-1/#comment-393</link>
		<dc:creator>Justin Case</dc:creator>
		<pubDate>Mon, 02 Mar 2009 06:35:41 +0000</pubDate>
		<guid isPermaLink="false">http://drwpf.com/blog/?p=42#comment-393</guid>
		<description>Hey Dr!&lt;br&gt;I thought I should turn to your seemingly bottomless well of knowledge for something that is bothering me regarding IEditableCollectionView.&lt;br&gt;Suppose I have an ObservableCollection&lt;PersonViewModel&gt;, let&#039;s call it &quot;People&quot;, and I manually create two ListCollectionViews for this, each collectionview using different sorting and filtering, but still refering to the same &quot;People&quot; collection. Displaying these two collectionviews in listboxes for instance works just fine.&lt;br&gt;But let&#039;s say that my application due to some interaction changes a property on one of the items contained within the &quot;People&quot; collection. Ok, now I have to check if the item is shown in CollectionView1 and in that case I just do &quot;EditItem(item);&quot; and &quot;CommitEdit(); and it works fine, it&#039;s refiltered (if needed) and resorted to the correct position. But I now also have to do the same thing on CollectionView2.&lt;br&gt;The problem starts when the item beeing changed isn&#039;t available in one of the collectionviews, because even if I have changed a property that should now include it in the collectionview, it won&#039;t pop up there, and I can&#039;t do an &quot;EditItem(item);&quot; and &quot;CommitEdit()&quot; since it&#039;s not in the collectionview (this throws an exception). Now I&#039;m left with the only option of doing the old trick of remove/re-add the item in the &quot;People&quot; collection instead (and I have to take care of any currency issues manually), hence IEditableCollectionView doesn&#039;t help if I have multiple collectionviews of one single collection.&lt;br&gt;&lt;br&gt;Am I missing something or is this something it probably wasn&#039;t meant to support? Should I keep two duplicate collections instead maybe? Any tips or bright ideas? Thanks!&lt;br&gt;&lt;br&gt;Cheers!</description>
		<content:encoded><![CDATA[<p>Hey Dr!<br />I thought I should turn to your seemingly bottomless well of knowledge for something that is bothering me regarding IEditableCollectionView.<br />Suppose I have an ObservableCollection
<personviewmodel>, let&#8217;s call it &#8220;People&#8221;, and I manually create two ListCollectionViews for this, each collectionview using different sorting and filtering, but still refering to the same &#8220;People&#8221; collection. Displaying these two collectionviews in listboxes for instance works just fine.<br />But let&#8217;s say that my application due to some interaction changes a property on one of the items contained within the &#8220;People&#8221; collection. Ok, now I have to check if the item is shown in CollectionView1 and in that case I just do &#8220;EditItem(item);&#8221; and &#8220;CommitEdit(); and it works fine, it&#8217;s refiltered (if needed) and resorted to the correct position. But I now also have to do the same thing on CollectionView2.<br />The problem starts when the item beeing changed isn&#8217;t available in one of the collectionviews, because even if I have changed a property that should now include it in the collectionview, it won&#8217;t pop up there, and I can&#8217;t do an &#8220;EditItem(item);&#8221; and &#8220;CommitEdit()&#8221; since it&#8217;s not in the collectionview (this throws an exception). Now I&#8217;m left with the only option of doing the old trick of remove/re-add the item in the &#8220;People&#8221; collection instead (and I have to take care of any currency issues manually), hence IEditableCollectionView doesn&#8217;t help if I have multiple collectionviews of one single collection.</p>
<p>Am I missing something or is this something it probably wasn&#8217;t meant to support? Should I keep two duplicate collections instead maybe? Any tips or bright ideas? Thanks!</p>
<p>Cheers!</personviewmodel>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dr. WPF</title>
		<link>http://drwpf.com/blog/2008/10/20/itemscontrol-e-is-for-editable-collection/comment-page-1/#comment-392</link>
		<dc:creator>Dr. WPF</dc:creator>
		<pubDate>Wed, 25 Feb 2009 06:32:14 +0000</pubDate>
		<guid isPermaLink="false">http://drwpf.com/blog/?p=42#comment-392</guid>
		<description>Hi David,&lt;br&gt;&lt;br&gt;If changes are truly occuring on a background thread within the model, then yes, you will likely have to wrap the collection and surface it as an observable collection in your viewmodel. That same wrapper could perform the edit/commit trick when an item changes in the underlying collection.&lt;br&gt;&lt;br&gt;The better long-term option would be to modify the model itself so that it supports and leverages IEditableObject for changes to items within the collection.&lt;br&gt;&lt;br&gt;Cheers,&lt;br&gt;-dw</description>
		<content:encoded><![CDATA[<p>Hi David,</p>
<p>If changes are truly occuring on a background thread within the model, then yes, you will likely have to wrap the collection and surface it as an observable collection in your viewmodel. That same wrapper could perform the edit/commit trick when an item changes in the underlying collection.</p>
<p>The better long-term option would be to modify the model itself so that it supports and leverages IEditableObject for changes to items within the collection.</p>
<p>Cheers,<br />-dw</p>
]]></content:encoded>
	</item>
</channel>
</rss>
