I want to invert the color (Fill
) of a FrameworkElement
in a ListViewItem
when the ListViewItem
is selected.
Problematic is that the FrameworkElement
that should have the selected Color is in another DataTemplate
in a nested DataTemplateSelector
.
Example:
<ListView>
<ListViewItem>
<ContentPresenter>
<ContentPresenter.ContentTemplateSelector>
<selector:IconTypeSelector>
<selector:IconTypeSelector.SuperImportantIcon>
<DataTemplate>
<Rectangle Width="27"
Height="27"
Fill="{DynamicResource ColorThatShouldChange}"><!--This is what i want to have the font color of my ListViewElements -->
</Rectangle>
</DataTemplate>
</selector:IconTypeSelector.SuperImportantIcon>
</selector:IconTypeSelector>
</ContentPresenter.ContentTemplateSelector>
</ContentPresenter>
</ListViewItem>
</ListView>
Best case scenario would be:
My FrameworkElement
(Rectangle
in example) binds on the same color as the font color of text in a ListViewItem
which gets inverted when selected.