<Style TargetType="ListViewItem">
<Setter Property="SnapsToDevicePixels" Value="true" />
<Setter Property="OverridesDefaultStyle" Value="true" />
<Setter Property="local:Properties.IsStatus" Value="{Binding IsStatus, Mode=OneWay}" />
<Setter Property="local:Properties.IsConnection" Value="{Binding IsConnection, Mode=OneWay}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListViewItem}">
<Border
x:Name="Border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}">
<ContentPresenter
x:Name="Content"
Margin="0,0,0,0"
TextBlock.Foreground="{TemplateBinding Foreground}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="local:Properties.IsStatus" Value="0" />
<Condition Property="local:Properties.IsConnection" Value="True" />
</MultiTrigger.Conditions>
<MultiTrigger.Setters>
<!-- Красный -->
<Setter Property="Background" Value="#FFFFCDD2" />
<Setter Property="Foreground" Value="#FFB71C1C" />
<Setter Property="BorderBrush" Value="#00D32F2F" />
</MultiTrigger.Setters>
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="local:Properties.IsStatus" Value="9" />
<Condition Property="local:Properties.IsConnection" Value="True" />
</MultiTrigger.Conditions>
<MultiTrigger.Setters>
<!-- Серый -->
<Setter Property="Background" Value="#FFF5F5F5" />
<Setter Property="Foreground" Value="#FF212121" />
<Setter Property="BorderBrush" Value="#00616161" />
</MultiTrigger.Setters>
</MultiTrigger>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#FFFFE0B2" />
<Setter Property="Foreground" Value="#FFE65100" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsSelected" Value="False" />
<Condition Property="local:Properties.IsConnection" Value="False" />
</MultiTrigger.Conditions>
<MultiTrigger.Setters>
<Setter Property="Background" Value="#FFFFFFFF" />
<Setter Property="Foreground" Value="#FF000000" />
<Setter Property="BorderBrush" Value="#00000000" />
</MultiTrigger.Setters>
</MultiTrigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#FFE8EAF6" />
<Setter Property="Foreground" Value="#FF1A237E" />
</Trigger>
</Style.Triggers>
</Style>
<ContentControl Grid.Row="1" Name="Channel_1" Content="{Binding ControlChannelDevice[0]}"/>
<ContentControl Grid.Row="1" Name="Channel_2" Content="{Binding ControlChannelDevice[1]}"/>
<ContentControl Grid.Row="1" Name="Channel_3" Content="{Binding ControlChannelDevice[2]}"/>
<ContentControl Grid.Row="1" Name="Channel_4" Content="{Binding ControlChannelDevice[3]}"/>
Channel_1.DataContext = ControlChannelsDevice;
Channel_2.DataContext = ControlChannelsDevice;
Channel_3.DataContext = ControlChannelsDevice;
Channel_4.DataContext = ControlChannelsDevice;
<DataTemplate x:Key="SelectContext">
<Border x:Name="Data">
<Grid x:Name="ContentBase" Margin="1,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label
Grid.Column="0"
Margin="0"
Padding="0"
HorizontalAlignment="Left"
Content="{Binding Content, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContentPresenter}}"
Foreground="{Binding Foreground, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContentPresenter}}" />
<RadioButton
Name="_1"
Grid.Column="1"
Content="1"
Style="{StaticResource RadioButtonKeys}" />
<RadioButton
Name="_2"
Grid.Column="2"
Content="2"
Style="{StaticResource RadioButtonKeys}" />
<RadioButton
Name="_3"
Grid.Column="3"
Content="3"
Style="{StaticResource RadioButtonKeys}" />
</Grid>
</Border>
</DataTemplate>
Foreground="{Binding Foreground, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContentPresenter}}"
на Foreground="{Binding Foreground, RelativeSource={RelativeSource Mode=Self}}"
<!-- ListBoxItem -->
<Style x:Key="Item"
BasedOn="{x:Null}"
TargetType="{x:Type ListBoxItem}">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
<Setter Property="Foreground" Value="Black"/>
<Setter Property="Height" Value="42"/>
<Setter Property="Margin" Value="-2,0,0,0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Grid x:Name="ListItem">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="ListItem_Text"
Grid.Column="0"
Padding="10,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="13"
FontWeight="Medium"
Foreground="{TemplateBinding Foreground}"
Text="{TemplateBinding Content}"/>
<RadioButton x:Name="PART_SelectVariable_1"
Grid.Column="1"
Content="Вариант 1"
IsEnabled="{TemplateBinding IsEnabled}"
Style="{StaticResource {x:Type ToggleButton}}"/>
<RadioButton x:Name="PART_SelectVariable_2"
Grid.Column="2"
Content="Вариант 2"
IsEnabled="{TemplateBinding IsEnabled}"
Style="{StaticResource {x:Type ToggleButton}}"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="ListItem" Property="Background" Value="#FF203FE6"/>
<Setter TargetName="ListItem_Text" Property="Foreground" Value="White"/>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter TargetName="ListItem" Property="Background" Value="LightGray"/>
<Setter TargetName="ListItem_Text" Property="Foreground" Value="DarkGray"/>
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="ListItem" Property="Background" Value="#FFFDDFAD"/>
<Setter TargetName="ListItem_Text" Property="Foreground" Value="#FFA47C38"/>
</Trigger>
<Trigger Property="local:Styles.IsRadioButton" Value="-1">
<Setter Property="DataContext" Value="0"/>
<Setter TargetName="PART_SelectVariable_1" Property="IsChecked" Value="false"/>
<Setter TargetName="PART_SelectVariable_2" Property="IsChecked" Value="false"/>
</Trigger>
<DataTrigger Binding="{Binding ElementName=PART_SelectVariable_1, Path=IsPressed}"
Value="True">
<Setter TargetName="ListItem" Property="Background" Value="#FFE8E9F2"/>
<Setter TargetName="ListItem_Text" Property="Foreground" Value="#FF9A9FB8"/>
<Setter Property="local:Styles.IsRadioButton" Value="1"/>
<Setter Property="IsSelected" Value="True"/>
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=PART_SelectVariable_2, Path=IsPressed}"
Value="True">
<Setter TargetName="ListItem" Property="Background" Value="#FFE8E9F2"/>
<Setter TargetName="ListItem_Text" Property="Foreground" Value="#FF9A9FB8"/>
<Setter Property="local:Styles.IsRadioButton" Value="2"/>
<Setter Property="IsSelected" Value="True"/>
</DataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>