You cannot use a DataTrigger
in a TriggerCollection
... yes, yes, I know... it's madness. However, you can put one in the TriggerCollection
of a Style
:
<ItemsControl.Style>
<Style>
<Style.Triggers>
<DataTrigger Binding="{Binding Items.Count}" Value="2">
<Setter TargetName="DocHost" Property="UniformGrid.Rows" Value="2"/>
</DataTrigger>
</Style.Triggers>
</Style>
</ItemsControl.Style>
UPDATE >>>
Sorry, I didn't see that TargetName
in there. The answer is to move this DataTrigger
into the UnifrmGrid.Style
instead and remove the TargetName
property, but then you might have some trouble Binding
to the Items
property... let me know if you have any more problems.