<Window x:Class="ResourceRange.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Window.Resources>
        <LinearGradientBrush x:Key="listBoxBackground" StartPoint="0,0" EndPoint="1,1">
            <GradientStop Color="CornflowerBlue" Offset="0"/>
            <GradientStop Color="White" Offset="1"/>
        </LinearGradientBrush>
        <Button x:Key="redButton" Background="red"/>
    </Window.Resources>
    <ListBox Margin="10" >
        <ListBox.Resources>
            <LinearGradientBrush x:Key="listBoxBackground" StartPoint="0,0" EndPoint="1,1">
                <GradientStop Color="Red" Offset="0"/>
                <GradientStop Color="White" Offset="1"/>
            </LinearGradientBrush>
        </ListBox.Resources>
        <ListBox.Background>
            <StaticResourceExtension ResourceKey="listBoxBackground"/>
        </ListBox.Background>
        <ListBoxItem>Element1</ListBoxItem>
        <ListBoxItem>Element2</ListBoxItem>
        <ListBoxItem>Element3</ListBoxItem>
    </ListBox>
</Window>
