Is it possible to use a wild card or call a method to work out if a DataTrigger should be applied?
I currently have my DataList bound to an IEnumerable that contains file names and I want the file names to be greyed out if there files extension starts with “old”
My non-working dream xaml markup looks something like this:
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding}" Value="*.old*">
<Setter TargetName="FileName" Property="Foreground" Value="Gray"/>
</DataTrigger>
</DataTemplate.Triggers>
The only workable solution I’ve been able to come up with is to insert a new view model property that contains this logic, but I would like to avoid changing the view model if possible.
The answer to both questions is yes….in a roundabout way
If you use a Binding Converter you can pass a parameter to it and have it return a boolean, that would be an effective way to do what you describe.
where the converter would look something like this
basically when the file extension matches you get a “true” which will fire the trigger.