I have TextBoxes and FakeTextBoxes in my application. FakeTextBoxes acts as TextBoxes, but they have more functionality as they have buttons, and/or images inside it. XAML for a FakeTextBox looks something like this:
<Border BorderThickness="1">
<StackPanel Orientation="Horizontal">
<TextBox BorderThickness="0" />
<Button>I'm a button inside textbox</Button>
</StackPanel>
</Border>
TextBox in my project have a custom styling that changes its BorderBrush depending on its IsMouseOver and GotFocus properties. The generic style comes from mahapps.metro and you can find it here : https://github.com/MahApps/MahApps.Metro/blob/develop/MahApps.Metro/Styles/Controls.TextBox.xaml
The problem is that I can't apply the same behaviour for the border of my FakeTextBox. I want to have the exactly same behavior on my custom Border so that it'll look like exactly the same as other TextBoxes.
What I've tried and didn't work for Border:
- Binding to
BorderBrushproperty of innerTextBox. - Binding to
IsFocusedproperty ofTextBox: IsFocused has no setter. - Creating a hidden
TextBoxand binding to itsBorderBrush
Is there a generic and/or easy solution to it?