Silverlight: Problem using CellEditingTemplate

Posted by Charles on Stack Overflow See other posts from Stack Overflow or by Charles
Published on 2009-08-10T18:57:27Z Indexed on 2010/04/11 4:03 UTC
Read the original article Hit count: 788

Filed under:
|
|

Hello Silverlight gurus,

I am experiencing a problem with the DataGrid where my data-bound object's properties are not being updated when using the CellTemplate/CellEditingTemplate:

<data:DataGridTemplateColumn Header="Text">
    <data:DataGridTemplateColumn.CellTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding Text}" ></TextBlock>
        </DataTemplate>
    </data:DataGridTemplateColumn.CellTemplate>
    <data:DataGridTemplateColumn.CellEditingTemplate>
        <DataTemplate>
            <TextBox Text="{Binding Text, Mode=TwoWay}" />
        </DataTemplate>
    </data:DataGridTemplateColumn.CellEditingTemplate>
</data:DataGridTemplateColumn>

I am binding to a code-gen'd entity via the RIA Services. I've added an event handler to the PropertyChanged event, and it is never fired. However, if I do not use a template and instead use a DataGridTextColumn, everything works fine.

I'm sure this sounds like an easy fix - I'm only using a TextBox in my editing template, so why not us a DataGridTextColumn? The problem is that I want to have a multi-line textbox, so using the DataGridTextColumn is not an option.

Any suggestions? Do you know of any differences between using a CellEditingTemplate containing a single TextBox and using a DataGridTextColumn?

Thanks,
-Charles

[UPDATE]
I posted a bug report here:
http://silverlight.net/forums/p/118729/267521.aspx

I can't imagine that this is "as-designed"... If someone else has known about this and I'm just being dumb, I'd appreciate an explanation - I'd prefer embarrassment over ignorance :).

© Stack Overflow or respective owner

Related posts about silverlight-3.0

Related posts about c#