<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:AvalonEdit="clr-namespace:ICSharpCode.AvalonEdit"
	xmlns:cc="clr-namespace:ICSharpCode.AvalonEdit.CodeCompletion"
>
	<Style TargetType="{x:Type ListBoxItem}" x:Key="CompletionListBoxItem">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type ListBoxItem}">
					<Border Name="Bd"
					        Background="{TemplateBinding Background}"
					        BorderBrush="{TemplateBinding BorderBrush}"
					        BorderThickness="{TemplateBinding BorderThickness}"
					        Padding="{TemplateBinding Padding}"
					        SnapsToDevicePixels="true">
						<ContentPresenter
							HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
							VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
							SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
					</Border>
					<!-- Simplified triggers:
 						we don't want a gray selection background when the ListBox doesn't have focus
					-->
					<ControlTemplate.Triggers>
						<Trigger Property="IsSelected" Value="true">
							<Setter Property="Background"
							        Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
							<Setter Property="Foreground"
							        Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	
	<Style TargetType="{x:Type cc:CompletionList}">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type cc:CompletionList}">
					<cc:CompletionListBox x:Name="PART_ListBox"
						ItemContainerStyle="{StaticResource CompletionListBoxItem}">
						<ItemsControl.ItemTemplate>
							<DataTemplate>
								<StackPanel Orientation="Horizontal">
									<Image Source="{Binding Image}" Width="16" Height="16" Margin="0,0,2,0"/>
									<ContentControl Content="{Binding Content}"/>
								</StackPanel>
							</DataTemplate>
						</ItemsControl.ItemTemplate>
					</cc:CompletionListBox>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
</ResourceDictionary>