Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I found a solution, but I can't explain why it makes a difference:</p> <p>Change this...</p> <pre><code>&lt;data:DataGridTemplateColumn Header="Text"&gt; &lt;data:DataGridTemplateColumn.CellTemplate&gt; &lt;DataTemplate&gt; &lt;TextBlock Text="{Binding Text}" &gt;&lt;/TextBlock&gt; &lt;/DataTemplate&gt; &lt;/data:DataGridTemplateColumn.CellTemplate&gt; &lt;data:DataGridTemplateColumn.CellEditingTemplate&gt; &lt;DataTemplate&gt; &lt;TextBox Text="{Binding Text, Mode=TwoWay}" /&gt; &lt;/DataTemplate&gt; &lt;/data:DataGridTemplateColumn.CellEditingTemplate&gt; &lt;/data:DataGridTemplateColumn&gt; </code></pre> <p>... to this:</p> <pre><code>&lt;data:DataGridTemplateColumn Header="Text"&gt; &lt;data:DataGridTemplateColumn.CellTemplate&gt; &lt;DataTemplate&gt; &lt;TextBlock Text="{Binding Text, Mode=OneWay}" &gt;&lt;/TextBlock&gt; &lt;/DataTemplate&gt; &lt;/data:DataGridTemplateColumn.CellTemplate&gt; &lt;data:DataGridTemplateColumn.CellEditingTemplate&gt; &lt;DataTemplate&gt; &lt;TextBox Text="{Binding Text, Mode=TwoWay}" /&gt; &lt;/DataTemplate&gt; &lt;/data:DataGridTemplateColumn.CellEditingTemplate&gt; &lt;/data:DataGridTemplateColumn&gt; </code></pre> <p><br> Notice how I specified "Mode=OneWay" on the TextBlock's binding:</p> <pre><code>&lt;TextBlock Text="{Binding Text, Mode=OneWay}" &gt;&lt;/TextBlock&gt; </code></pre> <p><br> I have no idea why this should make a difference. Even if the TextBlock was set to TwoWay, why wouldn't there be any changes made to the data-bound object?</p> <p>An explanation would be greatly appreciated... I've spent about five hours banging my head against my keyboard just to get to this point, and I'd like to know why it is that I've made this mistake (assuming it's not a bug in Silverlight).</p> <p>Thanks,<br> -Charles</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload