<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:Controls="clr-namespace:ICSharpCode.ILSpy.Controls">
	
	<Style TargetType="{x:Type Controls:ZoomScrollViewer}">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Controls:ZoomScrollViewer}">
					<Grid Background="{TemplateBinding Panel.Background}">
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="Auto" />
							<ColumnDefinition Width="*" />
							<ColumnDefinition Width="Auto" />
						</Grid.ColumnDefinitions>
						<Grid.RowDefinitions>
							<RowDefinition Height="*" />
							<RowDefinition Height="Auto" />
						</Grid.RowDefinitions>
						<Controls:SelfCollapsingPanel Grid.Column="0" Grid.Row="1" CollapseOrientation="Horizontal" CanCollapse="{Binding Path=ComputedZoomButtonCollapsed, Mode=OneWay, RelativeSource={RelativeSource Mode=TemplatedParent}}">
							<Controls:ZoomButtons x:Name="zoomButtons" Value="{Binding Path=CurrentZoom, RelativeSource={RelativeSource Mode=TemplatedParent}}" Minimum="{TemplateBinding MinimumZoom}" Maximum="{TemplateBinding MaximumZoom}" />
						</Controls:SelfCollapsingPanel>
						<Rectangle Grid.Column="2" Grid.Row="1" Fill="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
						<ScrollContentPresenter Name="PART_Presenter" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="0" Margin="{TemplateBinding Control.Padding}" Content="{TemplateBinding ContentControl.Content}" ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" CanContentScroll="{TemplateBinding ScrollViewer.CanContentScroll}">
							<ScrollContentPresenter.LayoutTransform>
								<ScaleTransform ScaleX="{Binding Path=CurrentZoom, RelativeSource={RelativeSource Mode=TemplatedParent}}" ScaleY="{Binding Path=CurrentZoom, RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
							</ScrollContentPresenter.LayoutTransform>
						</ScrollContentPresenter>
						<ScrollBar Name="PART_VerticalScrollBar" Grid.Column="2" Grid.Row="0" Minimum="0" Maximum="{TemplateBinding ScrollableHeight}" ViewportSize="{TemplateBinding ViewportHeight}" Value="{TemplateBinding VerticalOffset}" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" />
						<ScrollBar Name="PART_HorizontalScrollBar" Orientation="Horizontal" Grid.Column="1" Grid.Row="1" Minimum="0" Maximum="{TemplateBinding ScrollableWidth}" ViewportSize="{TemplateBinding ViewportWidth}" Value="{TemplateBinding HorizontalOffset}" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" />
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<!-- Template for CollapsiblePanel -->
	<Style TargetType="{x:Type Controls:CollapsiblePanel}">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="Controls:CollapsiblePanel">
					<ControlTemplate.Resources>
						<Controls:CollapsiblePanelProgressToVisibilityConverter x:Key="visibilityConverter"/>
					</ControlTemplate.Resources>
					<Border
						BorderThickness="{TemplateBinding Border.BorderThickness}"
						BorderBrush="{TemplateBinding Border.BorderBrush}"
						Background="{TemplateBinding Panel.Background}"
						SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}"
						Name="PART_Border"
						Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=AnimationProgress, Converter={StaticResource visibilityConverter}}"
					>
						<Border.LayoutTransform>
							<ScaleTransform ScaleX="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=AnimationProgressX}"
							                ScaleY="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=AnimationProgressY}"/>
						</Border.LayoutTransform>
						<ContentPresenter
							Margin="{TemplateBinding Control.Padding}"
							Content="{TemplateBinding ContentControl.Content}"
							ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
							ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}"
							HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
							VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
							SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
					</Border>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style x:Key="ZoomButtonStyle"
	       TargetType="RepeatButton">
		<Setter Property="Delay" Value="0" />
		<Setter Property="Focusable" Value="False" />
		<Setter Property="Opacity" Value="0.5" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="RepeatButton">
					<ContentPresenter />
					<ControlTemplate.Triggers>
						<Trigger Property="IsMouseOver" Value="True">
							<Setter Property="Opacity" Value="1" />
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	
	<Style TargetType="{x:Type Controls:ZoomButtons}">
		<Setter Property="Minimum" Value="0.2"/>
		<Setter Property="Maximum" Value="10"/>
		<Setter Property="Value" Value="1"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Controls:ZoomButtons}">
					<Border Background="{TemplateBinding Background}"
					        BorderBrush="{TemplateBinding BorderBrush}"
					        BorderThickness="{TemplateBinding BorderThickness}">
						<StackPanel Orientation="Horizontal"
						            Background="#3000">
							<RepeatButton x:Name="uxPlus"
							              Width="16" Height="16" Padding="0" BorderThickness="0"
							              Style="{StaticResource ZoomButtonStyle}">
								<Image Source="{Controls:XamlResource Images/ZoomIn}"
								       Stretch="Uniform"/>
							</RepeatButton>
							<RepeatButton x:Name="uxMinus"
							              Width="16" Height="16" Padding="0" BorderThickness="0"
							              Style="{StaticResource ZoomButtonStyle}">
								<Image Source="{Controls:XamlResource Images/ZoomOut}"
								       Stretch="Uniform" />
							</RepeatButton>
							<RepeatButton x:Name="uxReset"
							              Width="16" Height="16" Padding="0" BorderThickness="0"
							              Style="{StaticResource ZoomButtonStyle}">
								<Border Background="#5000">
									<TextBlock Foreground="White"
									           HorizontalAlignment="Center"
									           VerticalAlignment="Center">1</TextBlock>
								</Border>
							</RepeatButton>
						</StackPanel>
					</Border>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
</ResourceDictionary>