我有一个 XAML 代码。我正在尝试填充 Datatrigger 上的矩形,但它没有触发
<ItemsControl Grid.Row="1" Grid.Column="1" ItemsSource="{Binding SelectedEnrollments}" Visibility="{Binding EnrollmentsExist, Converter={x:Static s:BooleanToVisibilityConverter.Default}, Mode=TwoWay}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<RadioButton Tag="{Binding Id}" GroupName="Enrollments" ToolTip="{Binding Title}" Checked="EnrollmentRadioButton_Checked" IsChecked="{Binding IsSelected}">
<RadioButton.ContentTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock TextTrimming="CharacterEllipsis"
Text="{Binding ToolTip, RelativeSource={RelativeSource FindAncestor, AncestorType=RadioButton}}" />
<Rectangle x:Name="RankIcon" Width="30">
<Rectangle.Style>
<Style>
<Style.Triggers>
<DataTrigger Binding="{Binding Rank}" Value="Primary">
<Setter Property="Rectangle.Fill" Value="Blue"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding Rank}" Value="Secondary">
<Setter Property="Rectangle.Fill" Value="{DynamicResource IconRankSecondary}"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</Rectangle.Style>
</Rectangle>
</StackPanel>
<DataTemplate.Triggers>
</DataTemplate.Triggers>
</DataTemplate>
</RadioButton.ContentTemplate>
</RadioButton>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
请帮助任何人