<?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: Why should I use ObjectDataProvider?</title>
	<atom:link href="http://bea.stollnitz.com/blog/?feed=rss2&#038;p=22" rel="self" type="application/rss+xml" />
	<link>http://bea.stollnitz.com/blog/?p=22</link>
	<description>on Silverlight and WPF</description>
	<lastBuildDate>Thu, 22 Jul 2010 20:56:04 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Bea</title>
		<link>http://bea.stollnitz.com/blog/?p=22&#038;cpage=1#comment-193286</link>
		<dc:creator>Bea</dc:creator>
		<pubDate>Wed, 10 Mar 2010 06:09:15 +0000</pubDate>
		<guid isPermaLink="false">http://bea.stollnitz.com/blog/?p=22#comment-193286</guid>
		<description>Hi Lina,

I&#039;m glad you found an answer. Sorry I couldn&#039;t get to your question earlier.

Bea</description>
		<content:encoded><![CDATA[<p>Hi Lina,</p>
<p>I&#8217;m glad you found an answer. Sorry I couldn&#8217;t get to your question earlier.</p>
<p>Bea</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: simon</title>
		<link>http://bea.stollnitz.com/blog/?p=22&#038;cpage=1#comment-190184</link>
		<dc:creator>simon</dc:creator>
		<pubDate>Mon, 22 Feb 2010 15:19:48 +0000</pubDate>
		<guid isPermaLink="false">http://bea.stollnitz.com/blog/?p=22#comment-190184</guid>
		<description>Has anyone found a workaround for this ?</description>
		<content:encoded><![CDATA[<p>Has anyone found a workaround for this ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lina Manjarres</title>
		<link>http://bea.stollnitz.com/blog/?p=22&#038;cpage=1#comment-186725</link>
		<dc:creator>Lina Manjarres</dc:creator>
		<pubDate>Mon, 01 Feb 2010 22:36:30 +0000</pubDate>
		<guid isPermaLink="false">http://bea.stollnitz.com/blog/?p=22#comment-186725</guid>
		<description>I found my solution in this thread: http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/28b6750b-d715-474f-b5b8-a2c6653ea6ca?prof=required

Thanks a lot!!</description>
		<content:encoded><![CDATA[<p>I found my solution in this thread: <a href="http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/28b6750b-d715-474f-b5b8-a2c6653ea6ca?prof=required" rel="nofollow">http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/28b6750b-d715-474f-b5b8-a2c6653ea6ca?prof=required</a></p>
<p>Thanks a lot!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lina Manjarres</title>
		<link>http://bea.stollnitz.com/blog/?p=22&#038;cpage=1#comment-186624</link>
		<dc:creator>Lina Manjarres</dc:creator>
		<pubDate>Sun, 31 Jan 2010 05:22:40 +0000</pubDate>
		<guid isPermaLink="false">http://bea.stollnitz.com/blog/?p=22#comment-186624</guid>
		<description>Thanks Bea for this post and other post you have in binding.
I have one problem. I need to bind a DataGrid to vallidate if the data is loaded is not outbound. There are several columns that have to evaluate. The problem is, that I need the value of a textbox.text in the XAML. I need it, for evaluation porpuses.
I have the validation working with IValueConverter. It change the color of the cell, after evaluating the cell that is outbound.
However, I haven&#039;t being able to pass the textbox value. I have tried using ConverterParameter, but I only get the name I have in the ConverterParameter, instead of its value.
Is there a way I can do this. I have been tring to solve this for a week, and I am realy kind of desperate.
Thanks a lot for your time!!
Lina</description>
		<content:encoded><![CDATA[<p>Thanks Bea for this post and other post you have in binding.<br />
I have one problem. I need to bind a DataGrid to vallidate if the data is loaded is not outbound. There are several columns that have to evaluate. The problem is, that I need the value of a textbox.text in the XAML. I need it, for evaluation porpuses.<br />
I have the validation working with IValueConverter. It change the color of the cell, after evaluating the cell that is outbound.<br />
However, I haven&#8217;t being able to pass the textbox value. I have tried using ConverterParameter, but I only get the name I have in the ConverterParameter, instead of its value.<br />
Is there a way I can do this. I have been tring to solve this for a week, and I am realy kind of desperate.<br />
Thanks a lot for your time!!<br />
Lina</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bea</title>
		<link>http://bea.stollnitz.com/blog/?p=22&#038;cpage=1#comment-185281</link>
		<dc:creator>Bea</dc:creator>
		<pubDate>Fri, 22 Jan 2010 18:18:14 +0000</pubDate>
		<guid isPermaLink="false">http://bea.stollnitz.com/blog/?p=22#comment-185281</guid>
		<description>Hi Rune,

Yeah, I can repro what you describe (by comparing the &lt;a href=&quot;http://bea.stollnitz.com/BlogComments/47ObjectDataProviderSampleVS2008.zip&quot; rel=&quot;nofollow&quot;&gt;VS 2008&lt;/a&gt; and &lt;a href=&quot;http://bea.stollnitz.com/BlogComments/48ObjectDataProviderSampleVS2010.zip&quot; rel=&quot;nofollow&quot;&gt;VS 2010&lt;/a&gt; versions of this project).

The error message I get in 2010 is:

System.Windows.Data Error: 8 : Cannot save value from target back to source. BindingExpression:Path=MethodParameters[0]; DataItem=&#039;ObjectDataProvider&#039; (HashCode=40998886); target element is &#039;TextBox&#039; (Name=&#039;tb&#039;); target property is &#039;Text&#039; (type &#039;String&#039;) ArgumentException:&#039;System.ArgumentException: Object of type &#039;MS.Internal.Data.PropertyPathWorker+IListIndexerArg&#039; cannot be converted to type &#039;System.Int32&#039;.
   at System.RuntimeType.TryChangeType(Object value, Binder binder, CultureInfo culture, Boolean needsSpecialCast)
   at System.RuntimeType.CheckValue(Object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr)
   at System.Reflection.MethodBase.CheckArguments(Object[] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
   at MS.Internal.Data.PropertyPathWorker.SetValue(Object item, Object value)
   at MS.Internal.Data.ClrBindingWorker.UpdateValue(Object value)
   at System.Windows.Data.BindingExpression.UpdateSource(Object value)&#039;

WPF 4.0 is supposed to be backwards compatible and shouldn&#039;t break apps written in 3.5. So this may be a bug in 4.0.

Thanks,
Bea</description>
		<content:encoded><![CDATA[<p>Hi Rune,</p>
<p>Yeah, I can repro what you describe (by comparing the <a href="http://bea.stollnitz.com/BlogComments/47ObjectDataProviderSampleVS2008.zip" rel="nofollow">VS 2008</a> and <a href="http://bea.stollnitz.com/BlogComments/48ObjectDataProviderSampleVS2010.zip" rel="nofollow">VS 2010</a> versions of this project).</p>
<p>The error message I get in 2010 is:</p>
<p>System.Windows.Data Error: 8 : Cannot save value from target back to source. BindingExpression:Path=MethodParameters[0]; DataItem=&#8217;ObjectDataProvider&#8217; (HashCode=40998886); target element is &#8216;TextBox&#8217; (Name=&#8217;tb&#8217;); target property is &#8216;Text&#8217; (type &#8216;String&#8217;) ArgumentException:&#8217;System.ArgumentException: Object of type &#8216;MS.Internal.Data.PropertyPathWorker+IListIndexerArg&#8217; cannot be converted to type &#8216;System.Int32&#8242;.<br />
   at System.RuntimeType.TryChangeType(Object value, Binder binder, CultureInfo culture, Boolean needsSpecialCast)<br />
   at System.RuntimeType.CheckValue(Object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr)<br />
   at System.Reflection.MethodBase.CheckArguments(Object[] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig)<br />
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)<br />
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)<br />
   at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)<br />
   at MS.Internal.Data.PropertyPathWorker.SetValue(Object item, Object value)<br />
   at MS.Internal.Data.ClrBindingWorker.UpdateValue(Object value)<br />
   at System.Windows.Data.BindingExpression.UpdateSource(Object value)&#8217;</p>
<p>WPF 4.0 is supposed to be backwards compatible and shouldn&#8217;t break apps written in 3.5. So this may be a bug in 4.0.</p>
<p>Thanks,<br />
Bea</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rune Baess</title>
		<link>http://bea.stollnitz.com/blog/?p=22&#038;cpage=1#comment-174152</link>
		<dc:creator>Rune Baess</dc:creator>
		<pubDate>Thu, 10 Dec 2009 11:26:50 +0000</pubDate>
		<guid isPermaLink="false">http://bea.stollnitz.com/blog/?p=22#comment-174152</guid>
		<description>Woops, I was a bit hasty .. the example works perfectly as long you compile it for the 3.5 framework (in VS 2010).
But if you convert it to WPF 4.0 project the method WeightOnPlanet on ObjectDataProvider is nolonger invoked on odp2 when you edit the textbox. 
I have tried to find any new Attributes on either the Binding or the ObjectDataProvider - but nothing has worked out so far ... 
Are there possibly a new way of doing this in WPF 4.0 ?</description>
		<content:encoded><![CDATA[<p>Woops, I was a bit hasty .. the example works perfectly as long you compile it for the 3.5 framework (in VS 2010).<br />
But if you convert it to WPF 4.0 project the method WeightOnPlanet on ObjectDataProvider is nolonger invoked on odp2 when you edit the textbox.<br />
I have tried to find any new Attributes on either the Binding or the ObjectDataProvider &#8211; but nothing has worked out so far &#8230;<br />
Are there possibly a new way of doing this in WPF 4.0 ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rune Baess</title>
		<link>http://bea.stollnitz.com/blog/?p=22&#038;cpage=1#comment-170558</link>
		<dc:creator>Rune Baess</dc:creator>
		<pubDate>Tue, 24 Nov 2009 10:58:55 +0000</pubDate>
		<guid isPermaLink="false">http://bea.stollnitz.com/blog/?p=22#comment-170558</guid>
		<description>Works perfectly in WPF 4.0 (beta 2) as well, thx.</description>
		<content:encoded><![CDATA[<p>Works perfectly in WPF 4.0 (beta 2) as well, thx.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bea</title>
		<link>http://bea.stollnitz.com/blog/?p=22&#038;cpage=1#comment-166492</link>
		<dc:creator>Bea</dc:creator>
		<pubDate>Mon, 12 Oct 2009 02:38:19 +0000</pubDate>
		<guid isPermaLink="false">http://bea.stollnitz.com/blog/?p=22#comment-166492</guid>
		<description>Hi Sriwantha,

I wrote about the two types of asynchronous binding in the following post: &lt;a href=&quot;http://bea.stollnitz.com/blog/?p=27&quot; rel=&quot;nofollow&quot;&gt;http://bea.stollnitz.com/blog/?p=27&lt;/a&gt; (so old I almost forgot I had written about it)

Bea</description>
		<content:encoded><![CDATA[<p>Hi Sriwantha,</p>
<p>I wrote about the two types of asynchronous binding in the following post: <a href="http://bea.stollnitz.com/blog/?p=27" rel="nofollow">http://bea.stollnitz.com/blog/?p=27</a> (so old I almost forgot I had written about it)</p>
<p>Bea</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sriwantha Sri Aravinda Attanayake</title>
		<link>http://bea.stollnitz.com/blog/?p=22&#038;cpage=1#comment-164767</link>
		<dc:creator>Sriwantha Sri Aravinda Attanayake</dc:creator>
		<pubDate>Thu, 24 Sep 2009 06:10:20 +0000</pubDate>
		<guid isPermaLink="false">http://bea.stollnitz.com/blog/?p=22#comment-164767</guid>
		<description>Great article indeed. I like the way you presented this. Keep it up! One more question where is the other asynchronous data binding part?
Sriwantha Sri Aravinda Attanayake</description>
		<content:encoded><![CDATA[<p>Great article indeed. I like the way you presented this. Keep it up! One more question where is the other asynchronous data binding part?<br />
Sriwantha Sri Aravinda Attanayake</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bea</title>
		<link>http://bea.stollnitz.com/blog/?p=22&#038;cpage=1#comment-153694</link>
		<dc:creator>Bea</dc:creator>
		<pubDate>Tue, 07 Jul 2009 22:58:06 +0000</pubDate>
		<guid isPermaLink="false">http://bea.stollnitz.com/blog/?p=22#comment-153694</guid>
		<description>Hi Slugman,

Your points are all very valid. The more separation there is between UI and data, the more scalable the application will be long term, there&#039;s no doubt about it.

The Model-View-ViewModel pattern is one of the most used techniques for achieving this separation in WPF. Very briefly, in this pattern the Model is your data, and the View is your UI (XAML and maybe a bit of code). The ViewModel is a layer introduced between the View and the Model that exposes the Model in a way that is more easily consumed by the View. It&#039;s ok for the ViewModel to use certain types introduced by WPF, and to make certain assumptions about the UI. The ViewModel is usually a pretty thin layer compared to the Model, still allowing easy portability to future (or alternative) technologies. So, in this pattern, your UI bindings communicate with the ViewModel and not with the Model.

These ideas were introduced by &lt;a href=&quot;http://blogs.msdn.com/johngossman/archive/2005/10/08/478683.aspx&quot; rel=&quot;nofollow&quot;&gt;John Gossman in his blog&lt;/a&gt; a while ago. John was an architect in Blend at the time, so his post explains in a high-level how Blend was designed. I&#039;m also a big fan of &lt;a href=&quot;http://blogs.msdn.com/dancre/archive/2006/10/11/datamodel-view-viewmodel-pattern-series.aspx&quot; rel=&quot;nofollow&quot;&gt;Dan Crevier&#039;s&lt;/a&gt; approach to this pattern (he was an architect in Max, another product that was heavily using WPF). Dan uses a slightly different terminology compared to John, but the basic idea is the same. I especially like how Dan deals with commanding in his approach. 

You ask why we added a feature that allows binding to methods. Well, as most of the features we add, this was introduced based on customer feedback, in the context of binding to web services. Users felt that creating a simple application that binds to a web service&#039;s method is a common enough scenario that shouldn&#039;t require code behind. 

In general, the main advantage of allowing a certain scenario to be created using XAML only is the fact that it becomes toolable. This is a huge advantage - it opens scenarios to designers and less advanced developers, and speeds up development for advanced developers.

My guess is that a large application that is following M-V-VM or any other pattern that allows clean separation between UI and data will likely not use binding to methods as a common practice. Also, any property and object names that it refers to in XAML will be referring to the ViewModel, and not the Model itself.

Thanks for your great comment.

Bea</description>
		<content:encoded><![CDATA[<p>Hi Slugman,</p>
<p>Your points are all very valid. The more separation there is between UI and data, the more scalable the application will be long term, there&#8217;s no doubt about it.</p>
<p>The Model-View-ViewModel pattern is one of the most used techniques for achieving this separation in WPF. Very briefly, in this pattern the Model is your data, and the View is your UI (XAML and maybe a bit of code). The ViewModel is a layer introduced between the View and the Model that exposes the Model in a way that is more easily consumed by the View. It&#8217;s ok for the ViewModel to use certain types introduced by WPF, and to make certain assumptions about the UI. The ViewModel is usually a pretty thin layer compared to the Model, still allowing easy portability to future (or alternative) technologies. So, in this pattern, your UI bindings communicate with the ViewModel and not with the Model.</p>
<p>These ideas were introduced by <a href="http://blogs.msdn.com/johngossman/archive/2005/10/08/478683.aspx" rel="nofollow">John Gossman in his blog</a> a while ago. John was an architect in Blend at the time, so his post explains in a high-level how Blend was designed. I&#8217;m also a big fan of <a href="http://blogs.msdn.com/dancre/archive/2006/10/11/datamodel-view-viewmodel-pattern-series.aspx" rel="nofollow">Dan Crevier&#8217;s</a> approach to this pattern (he was an architect in Max, another product that was heavily using WPF). Dan uses a slightly different terminology compared to John, but the basic idea is the same. I especially like how Dan deals with commanding in his approach. </p>
<p>You ask why we added a feature that allows binding to methods. Well, as most of the features we add, this was introduced based on customer feedback, in the context of binding to web services. Users felt that creating a simple application that binds to a web service&#8217;s method is a common enough scenario that shouldn&#8217;t require code behind. </p>
<p>In general, the main advantage of allowing a certain scenario to be created using XAML only is the fact that it becomes toolable. This is a huge advantage &#8211; it opens scenarios to designers and less advanced developers, and speeds up development for advanced developers.</p>
<p>My guess is that a large application that is following M-V-VM or any other pattern that allows clean separation between UI and data will likely not use binding to methods as a common practice. Also, any property and object names that it refers to in XAML will be referring to the ViewModel, and not the Model itself.</p>
<p>Thanks for your great comment.</p>
<p>Bea</p>
]]></content:encoded>
	</item>
</channel>
</rss>
