0

I have the following DataTemplates defined. The TextBlock works the xctk:ShortUpDown does not. In fact whenever I use a control from another namespace it doesn't work (i.e. no data displayed or updated

    <DataTemplate x:Key="intDataTemplate">
        <TextBlock Text="{Binding StringFormat=\{0:F0\}}"/>
    </DataTemplate>
    <DataTemplate x:Key="hexDataTemplate">
        <xctk:ShortUpDown ParsingNumberStyle="HexNumber"/>
    </DataTemplate>

These are the column definitions. There is no CellEditorTemplate available.

            <xcdg:Column FieldName="Coefficient" Width="75" 
                         CellContentTemplate="{StaticResource hexDataTemplate}"  ReadOnly="False"/>
            <xcdg:Column FieldName="Measured" Width="75" CellHorizontalContentAlignment="Right"
                         CellContentTemplate="{StaticResource intDataTemplate}" />

There just doesn't seem to be a lot of example code out there. The columns are auto generated.

Any suggestions are appreciated.

gbt
  • 1
  • 1

1 Answers1

0

The CellContentTemplate is for display purposes only. If you put a control meant for editing in it, such as a ShortUpDown, you will get weird results. Editor controls should be defined in the CellEditor. Also, don't forget to set the CellEditorBinding to connect it to the underlying value.

<xcdg:CellEditor x:Key="hexCellEditor">
    <xcdg:CellEditor.EditTemplate>
        <DataTemplate>
            <xctk:ShortUpDown Value="{xcdg:CellEditorBinding}" ParsingNumberStyle="HexNumber"/>
        </DataTemplate>
    </xcdg:CellEditor.EditTemplate>
</xcdg:CellEditor>

<xcdg:Column FieldName="Measured" CellEditor="{StaticResource hexCellEditor}" ... />
Diane-Xceed
  • 319
  • 1
  • 6