Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
Using Template for DataGrid Cell
posted

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>

 

Parents
No Data
Reply
  • 2320
    posted

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

     

    Otherwise, try changing CellClickAction to something like EnterEditModeIfAllowed.

Children
No Data