I have an Ellipse
in each TabControl
header which is to highlight blue if there is any items selected in the DataGrid
below it, otherwise it should be Transparent. At the moment I have the Trigger
in reverse so if the DataGrid
SelectedItems.Count
is 0 it is Transparent, if there is someway to have the default as transparent that would be nice.
Note: It will have multiple tabs and associated DataGrids
.
How can I get the Style
Trigger
working correctly on the Ellipse
?
<TabControl Name="tcGeometry" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="5" ItemsSource="{Binding GEOMETRIES}" >
<TabControl.ItemTemplate>
<DataTemplate>
<Grid>
<TextBlock Text="{Binding DISPLAY_NAME}" Margin="0,0,25,0"/>
<Ellipse x:Name="SelectionIndicator"
Width="8" Height="8"
Stroke="Black"
Fill="Blue"
StrokeThickness="1"
HorizontalAlignment="Right"
VerticalAlignment="Top">
<Ellipse.Style>
<Style TargetType="{x:Type Ellipse}">
<Style.Triggers>
<DataTrigger Binding="{Binding SelectedItems.Count, ElementName=dgAudit}" Value="0">
<Setter Property="Fill" Value="Transparent" />
</DataTrigger>
</Style.Triggers>
</Style>
</Ellipse.Style>
</Ellipse>
</Grid>
</DataTemplate>
</TabControl.ItemTemplate>
<TabControl.ContentTemplate>
<DataTemplate>
<Grid ShowGridLines="False">
<DataGrid Name="dgAudit"
Grid.Row="0"
Grid.Column="0"
IsReadOnly="True"
ItemsSource="{Binding GEOM_ASSET_OC_LIST}"
HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"
AutoGenerateColumns="False"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
RowDetailsVisibilityMode="Collapsed"
RowHeaderWidth="30" />
</Grid>
</DataTemplate>
</TabControl.ContentTemplate>
</TabControl>