For my WPF apps I have created a couple custom controls based on a TextBox. These include NumericTextBox, WatermarkTextBox, and ReturnTextBox.
Numeric and Watermark inherit from ReturnTextBox, which inherits from TextBox.
When I go to use any of my custom textboxes they work great. The one problem seems to be NumericTextBox and the MaxLength property. The property is now ignored and does not work. There is no code in any of my custom controls overriding or messing with the MaxLength property.
When I use MaxLength on my ReturnTextBox, it works just as you would expect:
<ui:ReturnTextBox MaxLength="35" Width="500" Background="LightYellow"
Text="{Binding BrRptCorpName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged,
ValidatesOnDataErrors=True}" TabIndex="2" />
However when I use the property on my NumericTextBox it is ignored and does not work:
<ui:NumericTextBox MaxLength="9" Background="LightYellow" Text="{Binding BrRptAmt,
Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" TabIndex="1" />
Can anyone help me figure out why MaxLength stops working? Is it because NumericTextBox does not directly inherit from TextBox? Should I be overriding MaxLength property in ReturnTextBox so it can be used by Numeric?
Thank you for your help!