﻿<ResourceDictionary xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:controls="clr-namespace:MyToolkit.Controls"
					xmlns:media="clr-namespace:MyToolkit.Media">

    <Style TargetType="controls:ScrollableItemsControl">
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <VirtualizingStackPanel />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ItemsControl">
                    <ScrollViewer x:Name="ScrollViewer">
                        <ItemsPresenter />
                    </ScrollViewer>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
	<Style TargetType="controls:WatermarkedTextBox">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="controls:WatermarkedTextBox">
					<TextBox x:Name="textBox" />
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	
	<Style TargetType="controls:ImageButton">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="controls:ImageButton">
					<Grid>
						<VisualStateManager.VisualStateGroups>
							<VisualStateGroup x:Name="CommonStates">
								<VisualState x:Name="Normal"/>
								<VisualState x:Name="MouseOver"/>
								<VisualState x:Name="Pressed">
									<Storyboard>
										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" 
                                                                       Storyboard.TargetName="PressedImage">
											<DiscreteObjectKeyFrame KeyTime="0">
												<DiscreteObjectKeyFrame.Value>
													<Visibility>Visible</Visibility>
												</DiscreteObjectKeyFrame.Value>
											</DiscreteObjectKeyFrame>
										</ObjectAnimationUsingKeyFrames>
										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" 
                                                                       Storyboard.TargetName="NormalImage">
											<DiscreteObjectKeyFrame KeyTime="0">
												<DiscreteObjectKeyFrame.Value>
													<Visibility>Collapsed</Visibility>
												</DiscreteObjectKeyFrame.Value>
											</DiscreteObjectKeyFrame>
										</ObjectAnimationUsingKeyFrames>
									</Storyboard>
								</VisualState>
								<VisualState x:Name="Disabled"/>
							</VisualStateGroup>
						</VisualStateManager.VisualStateGroups>
						<Image x:Name="NormalImage" Source="{TemplateBinding Image}"/>
						<Image x:Name="PressedImage" Source="{TemplateBinding PressedImage}" Visibility="Collapsed"/>
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style TargetType="controls:UnstyledButton">
		<Setter Property="Background" Value="Transparent"/>
		<Setter Property="BorderBrush" Value="{x:Null}" />
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Padding" Value="0,0,0,0"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
    </Style>

	<Style TargetType="controls:PanAndZoomViewer">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="controls:PanAndZoomViewer">
					<ContentPresenter x:Name="content">
						<ContentPresenter.RenderTransform>
							<CompositeTransform ScaleX="1" ScaleY="1" TranslateX="0" TranslateY="0"/>
						</ContentPresenter.RenderTransform>
					</ContentPresenter>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style TargetType="controls:PanAndZoomImage">
		<Setter Property="Stretch" Value="UniformToFill"/>
		<Setter Property="Background" Value="{StaticResource PhoneDisabledBrush}" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="controls:PanAndZoomImage">
					<ContentPresenter x:Name="content">
						<ContentPresenter.RenderTransform>
							<CompositeTransform ScaleX="1" ScaleY="1" TranslateX="0" TranslateY="0"/>
						</ContentPresenter.RenderTransform>
						<Border Background="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Background}" 
								Margin="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=InnerMargin}">
							<Image media:ImageHelper.Source="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Source}" 
								   CacheMode="BitmapCache"
								   Stretch="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Stretch}" 
								   x:Name="image">
							</Image>
						</Border>
					</ContentPresenter>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
</ResourceDictionary>
  