Could anyone tell me how i can bind to a Element of a Usercontrol?
Im trying to disable/enable a button using a datatrigger working together with IDataErrorInfo.
so i usually do this like this when the elements are on the same view
<Button Name="AddEditButton" Content="{Binding ButtonContent}" Command="{Binding AddCustomerCommand}" HorizontalAlignment="Center" Margin="0 10" >
<Button.Style>
<Style TargetType="{x:Type Button}">
<Setter Property="IsEnabled" Value="false" />
<Style.Triggers>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding ElementName=CustomerFirstNameTextBox, Path=(Validation.HasError)}" Value="false" />
<Condition Binding="{Binding ElementName=CustomerLastNameTextBox, Path=(Validation.HasError)}" Value="false" />
<Condition Binding="{Binding ElementName=CustomerEmailTextBox, Path=(Validation.HasError)}" Value="false" />
<Condition Binding="{Binding ElementName=CustomerPhoneTextBox, Path=(Validation.HasError)}" Value="false" />
<Condition Binding="{Binding ElementName=CustomerCellphoneTextBox, Path=(Validation.HasError)}" Value="false" />
</MultiDataTrigger.Conditions>
<Setter Property="IsEnabled" Value="true" />
</MultiDataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
But now i need to add a condition that binds to a control on a Usercontrol (AdressControl) that is being used by my view.
I was hoping to easily access the elements of the usercontrol like this
<Condition Binding="{Binding ElementName=AddressControl , Path=StreetTextBox.(Validation.HasError)}" Value="false" />
but to no avail. Any help would be much appreciated