How to run a predicate on ObjectInstance property of DataTrigger
-
27-10-2019 - |
Pergunta
I have a list saved in the ObjectInstance of the ObjectDataProvider class. When calling my datatrigger i would like to run a predicate on the list and return a value true/false so i can hide/show text. Ideally i would like to call a property "Noresults" that would return true/false so i can toggle text in the view.
<DataTrigger Binding="{Binding Path=ObjectDataProvider.NoResults, Mode=OneWay,Source={StaticResource DongleContentsProvider}, BindsDirectlyToSource=True}" Value="true">
<Setter TargetName="NoResults" Property="Visibility" Value="Visible" />
</DataTrigger>
Solução
Add a Binding.Converter
which does run any logic and returns a respective bool.
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow