Custom EditingElementStyle

Oct 7, 2008 at 8:07 PM
Is it required for the TargetType of an EditingElementStyle to be a TextBox?

I made a custom NumericTextBox : TextBox class a while back for display and edit of custom currency, percent, and decimal values. I'd like to apply this custom class to the EditingElementStyle of a Datagrid. Something like this:

            <Style x:Key="dgeesCurrency" TargetType="tc:NumericTextBox">
                <Setter Property="DataType" Value="Decimal"/>
                <Setter Property="FormatType" Value="Currency"/>
                <Setter Property="Padding" Value="0"/>
                <Setter Property="BorderThickness" Value="0"/>

However, I receive a "'NumericTextBox' TargetType does not match type of element 'TextBox'" error. Is there another way I can accomplish this?
Oct 7, 2008 at 9:02 PM
You can use the DataGridTemplateColumn for cases like this.  Just add the NumberTextBox element to the CellEditingTemplate of the DataGridTemplateColumn.