Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
45 lines (44 sloc) 2.33 KB
<Window x:Class="ListBox.Colors.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:testData="clr-namespace:TestData;assembly=TestData"
xmlns:utilities="clr-namespace:Utilities;assembly=Utilities"
mc:Ignorable="d"
DataContext="{Binding RelativeSource={RelativeSource Self}}"
Title="MainWindow" Height="450" Width="800">
<Grid>
<ListBox ItemsSource="{Binding People}">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
<!-- By default the background color is the Foreground color with an opacity applied -->
<!-- We can change the background color but the template will still be applying the opacity-->
<Setter Property="utilities:TreeHelpers.Modifiers">
<Setter.Value>
<utilities:ModifierCollection>
<utilities:Modifier TemplatePartName="SelectedBorder" Property="{x:Static Control.BackgroundProperty}">
<utilities:Modifier.Value>
<SolidColorBrush Color="Transparent" />
</utilities:Modifier.Value>
</utilities:Modifier>
</utilities:ModifierCollection>
</Setter.Value>
</Setter>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate DataType="testData:Person">
<TextBlock>
<TextBlock.Text>
<MultiBinding StringFormat="{}{0} {1}">
<Binding Path="FirstName" />
<Binding Path="LastName" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</Window>
You can’t perform that action at this time.