views:

428

answers:

1

Hello, I am trying to create a new WPF control called NumericTextBox.

It inherits directly from TextBox.

I added a new DependecyProperty called NumericValue that it could be used to bind a numeric property.

Now, I would like to override the behavior of the TextProperty so that it could be accessed only as ReadOnly.

Is it possible redefine its behavior?

+1  A: 

Not that i'm aware of, readonly DependencyProperties must be defined as such using the seperate DependencyProperty.RegisterReadOnly() method, you can not change a property to readonly after it's been defined. You can only override the metadata: things like callbacks, default value.

Bubblewrap
Thank you,I am working to let the control works both with NumericValueProperty binding and also with TextProperty.
marco.ragogna