SilverlightShow: Data Conversion in Silverlight Data Binding Comments http://www.silverlightshow.net/ Silverlight articles, Silverlight tutorials, Silverlight videos, Silverlight samples SilverlightShow.net http://www.rssboard.org/rss-specification Argotic Syndication Framework 2008.0.2.0, http://www.codeplex.com/Argotic en-US estoychev@completit.com (Emil Stoychev) RE: Data Conversion in Silverlight 2 Data Binding <p>I'm binding a list to a datasource.</p> <p> Then running converters on the resultant values.</p> <p>However if I try to update the values from an event I seem to get the wrong values. Any clues? Is the databound converter returning the value before I update it from my event? Hence me getting an old verion of the value? </p> <p>Thanks if anyone has any clues on this. </p> <p ></p> http://www.silverlightshow.net/items/Data-Conversion-in-Silverlight-2-Data-Binding.aspx#comment3499 CyberMan http://www.silverlightshow.net/items/Data-Conversion-in-Silverlight-2-Data-Binding.aspx Sun, 25 Apr 2010 17:56:31 GMT RE: Data Conversion in Silverlight 2 Data Binding Thanks a lot .This solved my problem http://www.silverlightshow.net/items/Data-Conversion-in-Silverlight-2-Data-Binding.aspx#comment2852 Manoj http://www.silverlightshow.net/items/Data-Conversion-in-Silverlight-2-Data-Binding.aspx Tue, 29 Dec 2009 11:32:39 GMT RE: Data Conversion in Silverlight 2 Data Binding <p>Hi Ali,</p> <p>I'm not aware of a way you can support that in design time. In my experience I would say that there is no way to do that, but don't just get my word for it.</p> <p>In WPF you can achieve that with</p> <p><span style="font-size: 13px; color: #0000ff;"> </span></p> <p><span style="font-size: 13px; color: #0000ff;"><</span><span style="font-size: 13px; color: #a31515;">TextBlock</span><span style="font-size: 13px; color: #ff0000;"> Text</span><span style="font-size: 13px; color: #0000ff;">="{</span><span style="font-size: 13px; color: #a31515;">Binding</span><span style="font-size: 13px; color: #ff0000;"> ElementName</span><span style="font-size: 13px; color: #0000ff;">=txtOriginal,</span><span style="font-size: 13px; color: #ff0000;"> Path</span><span style="font-size: 13px; color: #0000ff;">=Tag,</span><span style="font-size: 13px; color: #ff0000;"> Converter</span><span style="font-size: 13px; color: #0000ff;">={</span><span style="font-size: 13px; color: #a31515;">StaticResource</span><span style="font-size: 13px; color: #ff0000;"> PersianConverter</span><span style="font-size: 13px; color: #0000ff;">}}"</span><span style="font-size: 13px; color: #ff0000;"> x</span><span style="font-size: 13px; color: #0000ff;">:</span><span style="font-size: 13px; color: #ff0000;">Name</span><span style="font-size: 13px; color: #0000ff;">="txtPersian"</span><span style="font-size: 13px; color: #ff0000;"> Tag</span><span style="font-size: 13px; color: #0000ff;">="گچ پژ پارسی"</span><span style="font-size: 13px;"> </span><span style="font-size: 13px; color: #ff0000;">TextAlignment</span><span style="font-size: 13px; color: #0000ff;">="Right"/></span></p> <p>Unfortunately the ElementName is not supported in Silverlight data binding. </p> <p><br /> </p> http://www.silverlightshow.net/items/Data-Conversion-in-Silverlight-2-Data-Binding.aspx#comment571 emil http://www.silverlightshow.net/items/Data-Conversion-in-Silverlight-2-Data-Binding.aspx Tue, 21 Oct 2008 06:56:55 GMT RE: Data Conversion in Silverlight 2 Data Binding <p>Is there a way to bind The text value of textbox to itself. Don,t be confuesed. I have written a method which accept a string and then it returns that string in another format. Better say I want to do something like this:</p> <p><span style="font-size: 13px; color: #0000ff;"> </span></p> <p><span style="font-size: 13px; color: #0000ff;"><</span><span style="font-size: 13px; color: #a31515;">UserControl.Resources</span><span style="font-size: 13px; color: #0000ff;">></span></p> <p><span style="font-size: 13px; color: #0000ff;"></span><span style="font-size: 13px; color: #0000ff;"><span class="Apple-tab-span" style="white-space: pre;"> </span><</span><span style="font-size: 13px; color: #a31515;">myClasses</span><span style="font-size: 13px; color: #0000ff;">:</span><span style="font-size: 13px; color: #a31515;">PersianFormattingConverter</span><span style="font-size: 13px; color: #ff0000;"> x</span><span style="font-size: 13px; color: #0000ff;">:</span><span style="font-size: 13px; color: #ff0000;">Key</span><span style="font-size: 13px; color: #0000ff;">="PersianConverter"/></span></p> <span style="font-size: 13px; color: #a31515;"> <p> <span style="font-size: 13px; color: #0000ff;"></</span><span style="font-size: 13px; color: #a31515;">UserControl.Resources</span><span style="font-size: 13px; color: #0000ff;">></span></p> </span><span style="font-size: 13px; color: #0000ff;"> <p><<span style="font-size: 13px; color: #a31515;">TextBlock</span><span style="font-size: 13px; color: #ff0000;"> Text</span><span style="font-size: 13px; color: #0000ff;">="{</span><span style="font-size: 13px; color: #a31515;">Binding</span><span style="font-size: 13px; color: #ff0000;"> txtOriginal</span><span style="font-size: 13px; color: #0000ff;">.</span><span style="font-size: 13px; color: #ff0000;">Tag</span><span style="font-size: 13px; color: #0000ff;">,</span><span style="font-size: 13px; color: #ff0000;"> Converter</span><span style="font-size: 13px; color: #0000ff;">={</span><span style="font-size: 13px; color: #a31515;">StaticResource</span><span style="font-size: 13px; color: #ff0000;"> PersianConverter</span><span style="font-size: 13px; color: #0000ff;">}}"</span><span style="font-size: 13px; color: #ff0000;"> </span><span style="font-size: 13px; color: #ff0000;">x</span><span style="font-size: 13px; color: #0000ff;">:</span><span style="font-size: 13px; color: #ff0000;">Name</span><span style="font-size: 13px; color: #0000ff;">="txtPersian"</span><span style="font-size: 13px; color: #ff0000;"> Tag</span><span style="font-size: 13px; color: #0000ff;">="گچ پژ پارسی"</span><span style="font-size: 13px; color: #ff0000;"> </span><span style="font-size: 13px; color: #ff0000;"> TextAlignment</span><span style="font-size: 13px; color: #0000ff;">="Right"/></span></p> </span> <p>In fact, I am wring an API to support Persian language in silverlight 2.0 because Silverlight doesnot support right to left text. So I have written a class to do that stuff. Now I can change the text of my controls in runtime in C# code to show persian text well. But I want to support it in design time, too.</p> <p>Thank you very much.</p> <p><br /> </p> http://www.silverlightshow.net/items/Data-Conversion-in-Silverlight-2-Data-Binding.aspx#comment568 Ali Daneshmandi http://www.silverlightshow.net/items/Data-Conversion-in-Silverlight-2-Data-Binding.aspx Tue, 21 Oct 2008 03:43:46 GMT