Reputation: 13079
I built a custom control, TextBoxWithButton which is composed of a TextBox and a Button near it. I want to have an Opacity property in TextBoxWithButton, that when I change it, the opacity of both TextBox and Button changes.
This is the Opacity property in TextBoxWithButton :
private double opacity = 100;
public double Opacity
{
get { return opacity; }
set
{
opacity = value;
textBox.Opacity = opacity;
button.Opacity = opacity;
}
}
But how can I make the Opacity property in TextBoxWithButton a dependency property, so I can animate it, for example.
Upvotes: 0
Views: 199
Reputation: 5003
I think you should already have Opacity property inherited in your custom control form UIElement class. It will do exactly what you are asking for.
Upvotes: 1