<Style TargetType="{x:Type ListBoxItem}"> <Setter Property="Background" Value="Silver"/> <Style.Triggers> <Trigger Property="IsSelected" Value="True"> <Setter Property="Background" Value="Red"/> </Trigger> </Style.Triggers> </Style> </ListBox.Resources> <!--</ListBox.Resources>--> </ListBox> <Button x:Name="button" Content="Button" HorizontalAlignment="Left" Height="29" Margin="55,475,0,0" VerticalAlignment="Top" Width="214" Click="button_Click" Grid.ColumnSpan="2"/> <StackPanel HorizontalAlignment="Left" Height="362" Margin="169,76,0,0" VerticalAlignment="Top" Width="79" Grid.Column="1"> <Label x:Name="label1" MouseDown="label1_MouseDown" Content="" HorizontalAlignment="Left" Height="51" Width="79" Background="Red"/> <Label x:Name="label2" MouseDown="label2_MouseDown" Content="" HorizontalAlignment="Left" Height="51" Width="79" Background="Green"/> <Label x:Name="label3" MouseDown="label3_MouseDown" Content="" HorizontalAlignment="Left" Height="51" Width="79" Background="Yellow"/> <Label x:Name="label4" MouseDown="label4_MouseDown" Content="" HorizontalAlignment="Left" Height="51" Width="79" Background="Blue"/> <Label x:Name="label5" MouseDown="label5_MouseDown" Content="" HorizontalAlignment="Left" Height="51" Width="79" Background="Magenta"/> <Label x:Name="label6" MouseDown="label6_MouseDown" Content="" HorizontalAlignment="Left" Height="51" Width="79" Background="Cyan"/> <Label x:Name="label7" DragOver="label7_DragLeave" DragLeave="label7_DragLeave" Content="Random" HorizontalAlignment="Left" Height="51" Width="79" Background="White" FontSize="18" BorderThickness="1,0,1,1" BorderBrush="Black"/> </StackPanel> </Grid> </Window>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)