I have a user control that consists of a textblock and a textbox and if I validate via INotifyDataErrorInfo the underlying data the whole control gets a red border: How it looks like
I would like to use the textbox to show something is wrong in my user controls data, as if I had used a textbox instead of my control. In my case I'm using wpf material design so it looks like that.
My controls xaml:
<UserControl ....>
<Grid Height="40" Width="380" Margin="0,1,0,1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="110"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding ElementName=LabelWithInputUC,Path=Label}" Grid.Column="0" Margin="0,4,0,0" VerticalAlignment="Bottom"/>
<TextBox VerticalAlignment="Bottom"
Margin="10,0,30,0" Grid.Column="1"
x:Name="ContentTextBox"
MaxLength="{Binding ElementName=LabelWithInputUC,Path=MaxLength}"
IsReadOnly="{Binding ElementName=LabelWithInputUC,Path=IsReadOnly}"
Text="{Binding ElementName=LabelWithInputUC,Path=Text,UpdateSourceTrigger=PropertyChanged}"/>
</Grid>
</UserControl>
Label, MaxLength, IsReadOnly and Text are dependency properties in my usercontrol. The window that uses my control has the text property bound to a property in the viewmodel and there it get's validated with INotifyDataErrorInfo.
If I try to set the textbox as the controls ValidationAdornerSite I don't see any validation errors anymore. How do I use the inner textbox's error template for my user control?
Update
I created an minimal example to show the problem.