I have some problems with disabling one button if some controls inside a ListView have validation errors. It works for me when i check for errors directly from a control out of a ListView. Like in code below:
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource MaterialDesignRaisedButton}">
<Setter Property="IsEnabled" Value="False" />
<Style.Triggers>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding Path=(Validation.HasError), ElementName=TextBoxName}" Value="False" />
</MultiDataTrigger.Conditions>
<Setter Property="IsEnabled" Value="True" />
</MultiDataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
And the control has:
<TextBox Name="TextBoxName"
m:HintAssist.Hint="Title"
m:HintAssist.IsFloating="True">
<TextBox.Text>
<Binding Mode="TwoWay" Path="Test.Item1.Name" UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<local:NotEmptyValidationRule ValidatesOnTargetUpdated="True" />
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
So this works for me. But when i want to look inside of a ListView that has 6 controls(textboxes and comboboxes), i need to check if only two of them have errors.
How to find if only two controls from inside of a ListView have errors?
PS: I am using MVVM pattern. ListView has ItemTemplate, DataTemplate, and inside - controls like TextBox and ComboBox:
<ListView Name="ListViewTests" HorizontalAlignment="Center" Grid.Row="1" ItemsSource="{Binding SelectedActiveTests}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.CanContentScroll="False">
<ListView.ItemTemplate>
<DataTemplate>
Please help, and sorry for my bad english...