Hi everyone
I have a DataTemplate :
<DataTemplate x:Key="autoCompleteTemplate">
<Grid TextElement.FontSize="18">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="84" />
</Grid.ColumnDefinitions>
<Border Background="#FFFFFBDF">
<TextBlock Text="{Binding ItemName}" />
</Border>
<Border Grid.Column="1" Background="#FFFFFBDF">
<TextBlock Text="{Binding Balance,StringFormat=0.00}" />
</Border>
</Grid>
</DataTemplate>
i need to change the Background of the 2 borders inside the template when the ListBoxItem is selected
What I have tried:
I tried using an ItemContainerStyle by setting the properties of the Selected State using blend
so far i could change the color of the Background of the ListBoxItem as a whole when it's Selected but i only want to change the color of the inside borders of the content control which i can't access from the ItemContainerStyle
I also tried to make a separate DataTemplate for the Selected appearance
and tried to set the ContentControl in the Selected State To it , but that makes no difference
there is also the tiresome solution of using DataTriggers
basically to add an IsSelected Property to my Item Class
and implement INotifyPropertyChanged in it
and Set this property to True whenever the item Is Selected
and set the dataTemplate in the Trigger accordingly
but is there no other solution using XAML and Blend ,without having to change my class ?