Using Template for DataGrid Cell

This post has 1 Reply | 2 Followers

Points 20
TomBlackney
Replied On: Mon, Jan 19 2009 8:14 PM

Can anybody help me?? I'm kind of new at this...

 I have created a template to allow entry into a textbox for a column in my DataGrid (I've included the XAML below.)  Everything works fine when I change the Note column in an existing Row.  The problem I am having is when I try to add a Row. When I type in the Note Column of my add Row (row 1) nothing happens. It doesn't even recognize that I've made an entry in it. I'm I using the wrong template type? Is something wrong with my binding?  Thanks in advance if you can help me.

Here is how I've created the template and then applied it to the DataGrid cell:

Template

<Style TargetType="{x:Type igDP:CellValuePresenter}" x:Key="NoteTextBox">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}">
                <TextBox
                    MinWidth="400" TextWrapping="Wrap"
                    Name="AddNoteTextBox" AcceptsReturn="True" MaxLength="255"
                    Text="{Binding RelativeSource={RelativeSource TemplatedParent},
                    Path=Content, Mode=TwoWay}"
                    SpellCheck.IsEnabled="True"
                    AutoWordSelection="True" AcceptsTab="False"> 
                </TextBox>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

DATAGRID CELL

<igDP:Field Name="Text" Column="2" Label="Note">
    <igDP:Field.Settings>
    <igDP:FieldSettings
        AllowEdit="True"
        CellValuePresenterStyle="{StaticResource NoteTextBox}"
        CellClickAction="SelectRecord" />
    </igDP:Field.Settings>
</igDP:Field>

 

  • Post Points: 20
Points 2,230
temp0
Replied On: Wed, Jan 21 2009 8:35 PM

Might need some more information. Can you upload a working project that replicates the problem?

 

Otherwise, try changing CellClickAction to something like EnterEditModeIfAllowed.

  • Post Points: 5
Page 1 of 1 (2 items) | RSS