Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version
Go to top

Game Attack Combos : WPF Hybrid Smart Client for Combo Calculations

, 23 May 2009
A WPF hybrid smart client for calculating attack combos in the Prince of Persia game.
GameAttackCombos_Src.zip
ComboServices
App_Data
ComboPackagesService.svc
GameAttackCombos.snk
Properties
GameAttackCombos.mdf
GameAttackCombos_log.LDF
Packages
PrinceOfPersia2008.gcp
PrinceOfPersia2010.gcp
PackageComboFiles
Properties
ServiceData
GameAttackCombosModel.edmx
Properties
GameAttackCombos.snk
Assets
Button Icons.design
Game Attack Combos Icon.design
Game Attack Combos Icon.ico
Prince of Persia 2008
Prince of Persia 2010
PrinceOfPersia2010Background.png
PrinceOfPersia2010Icon.png
PrinceOfPersia2008Background.png
PrinceOfPersia2008Icon.png
ComboClient
Game Attack Combos Icon.ico
Properties
Resources
Service References
Supporting
Themes
ComboServices
ComboPackagesService.disco
ComboPackagesService.wsdl
ComboPackagesService1.wsdl
configuration.svcinfo
configuration91.svcinfo
Reference.svcmap
app.manifest
ComboLogic
Properties
GameAttackCombos_Standalone.zip
Packages
PrinceOfPersia2008.gcp
PrinceOfPersia2010.gcp
Resources
PresentationFramework.Aero.dll
GameAttackCombos.exe
GameAttackCombos.Logic.dll
<ResourceDictionary 
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:system="clr-namespace:System;assembly=mscorlib"
	xmlns:aero="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
	xmlns:local="clr-namespace:GG.GameAttackCombos.Client;assembly=GameAttackCombos">
	
	<Color x:Key="WindowBackgroundColor">#AE997E</Color>
	<Color x:Key="WindowBorderColor">#8E7759</Color>
	<Color x:Key="TitlebarLightColor">#9C8362</Color>
	<Color x:Key="InputBackgroundColor">#64708F</Color>
	<Color x:Key="InputTextColor">#D8DBE3</Color>
	<Color x:Key="InputBorderColor">#555B6C</Color>
	<Color x:Key="SelectionBackgroundColor">#555B6C</Color>
	<Color x:Key="SelectionInactiveBackgroundColor">#33CCCCCC</Color>
	<Color x:Key="InputGlyphColor">#CCFFFFFF</Color>
	
	<Color x:Key="BlendSelectionBackgroundColor">#CC555B6C</Color>
	<Color x:Key="BlendSelectionInactiveBackgroundColor">#99555B6C</Color>
	
	<Color x:Key="ShineColor">#80FFFFFF</Color>
	
	
	<SolidColorBrush x:Key="WindowBackgroundBrush" Color="{StaticResource WindowBackgroundColor}" />
	<SolidColorBrush x:Key="WindowBorderBrush" Color="{StaticResource WindowBorderColor}" />
	<SolidColorBrush x:Key="WindowTextBrush" Color="#EEEEEE" />
	
	<LinearGradientBrush x:Key="TitlebarBackgroundBrush" StartPoint="0,0" EndPoint="0,1">
		<GradientStop Color="{StaticResource TitlebarLightColor}" Offset="0" />
		<GradientStop Color="{StaticResource TitlebarLightColor}" Offset="0.5" />
		<GradientStop Color="{StaticResource WindowBorderColor}" Offset="0.5" />
		<GradientStop Color="{StaticResource WindowBorderColor}" Offset="1" />
	</LinearGradientBrush>
	<LinearGradientBrush x:Key="TitlebarShadowBrush" StartPoint="0,0" EndPoint="0,1">
		<GradientStop Color="{StaticResource WindowBorderColor}" Offset="0" />
		<GradientStop Color="#6D5C45" Offset="1" />
	</LinearGradientBrush>

	<SolidColorBrush x:Key="InputTextBrush" Color="{StaticResource InputTextColor}" />
	<SolidColorBrush x:Key="InputBackgroundBrush" Color="{StaticResource InputBackgroundColor}" />
	<SolidColorBrush x:Key="InputBorderBrush" Color="{StaticResource InputBorderColor}" />
	<SolidColorBrush x:Key="DisabledInputBackgroundBrush" Color="#66FFFFFF" />
	<SolidColorBrush x:Key="SelectionBackgroundBrush" Color="{StaticResource SelectionBackgroundColor}" />
	<SolidColorBrush x:Key="InputGlyphBrush" Color="{StaticResource InputGlyphColor}" />
	<SolidColorBrush x:Key="InputGroupTextBrush" Color="#BCC6DE" />
	<SolidColorBrush x:Key="WatermarkTextBrush" Color="#B0B6C6" />
	
	<SolidColorBrush x:Key="BlendDarkBackgroundBrush" Color="#66333333" />
	<SolidColorBrush x:Key="MenuBackgroundBrush" Color="#9964708F" />
	<SolidColorBrush x:Key="HighlightBorderBrush" Color="#99EEEEEE" />
	
	<SolidColorBrush x:Key="ButtonBorderBrush" Color="#735F48" />
	<SolidColorBrush x:Key="ButtonBackgroundBrush" Color="#967B5F" />
	<SolidColorBrush x:Key="ButtonTextBrush" Color="#E5DED7" />
	<SolidColorBrush x:Key="ButtonDisabledBackgroundBrush" Color="#837772" />
	<SolidColorBrush x:Key="ButtonDisabledTextBrush" Color="#CC685642" />
	<SolidColorBrush x:Key="ButtonOverBackgroundBrush" Color="#B09A84" />
	<LinearGradientBrush x:Key="ButtonShineBrush" StartPoint="0,0" EndPoint="0,1">
		<GradientStop Color="{StaticResource ShineColor}" Offset="0"/>
		<GradientStop Color="Transparent" Offset="1"/>
	</LinearGradientBrush>
	
	<SolidColorBrush x:Key="CloseButtonBorderBrush" Color="#B90000" />
	<SolidColorBrush x:Key="CloseButtonBackgroundBrush" Color="#B90000" />
	<SolidColorBrush x:Key="CloseButtonOverBackgroundBrush" Color="#FF0F0F" />
	
	<LinearGradientBrush x:Key="ThumbShineBrush" StartPoint="0,0" EndPoint="1,0">
		<GradientStop Color="{StaticResource ShineColor}" Offset="0"/>
		<GradientStop Color="Transparent" Offset="1"/>
	</LinearGradientBrush>

	
	<!-- Generic input styles -->
	<Style x:Key="InputStyle" TargetType="{x:Type Control}">
		<Setter Property="Background" Value="{StaticResource InputBackgroundBrush}" />
		<Setter Property="BorderBrush" Value="{StaticResource InputBorderBrush}" />
		<Setter Property="Foreground" Value="{StaticResource InputTextBrush}" />
		<Style.Triggers>
			<Trigger Property="IsEnabled" Value="False">
				<Setter Property="Background" Value="{StaticResource DisabledInputBackgroundBrush}" />
			</Trigger>
		</Style.Triggers>
	</Style>

	<Style x:Key="SelectorStyle" TargetType="{x:Type Selector}" BasedOn="{StaticResource InputStyle}">
		<Style.Resources>
			<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="{StaticResource SelectionBackgroundColor}" />
			<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="{StaticResource InputTextColor}" />
			<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="{StaticResource SelectionInactiveBackgroundColor}" />
			<SolidColorBrush x:Key="{x:Static SystemColors.ControlTextBrushKey}" Color="{StaticResource InputTextColor}" />
		</Style.Resources>
	</Style>


	<!-- Window styles -->
	<Style x:Key="TitlebarMinimizeButton" TargetType="{x:Type Button}">
		<Setter Property="Width" Value="16" />
		<Setter Property="Height" Value="16" />
		<Setter Property="Focusable" Value="False" />
		<Setter Property="IsTabStop" Value="False" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Button}">
					<Grid>
						<Rectangle Name="RectBackground" 
								   RadiusX="5" RadiusY="5" 
								   Fill="{StaticResource ButtonBackgroundBrush}"
								   Stroke="{StaticResource ButtonBorderBrush}" 
								   StrokeThickness="1" />
						<Rectangle x:Name="RectShine" 
								   RadiusX="3" RadiusY="3" 
								   Fill="{StaticResource ButtonShineBrush}"
								   Stroke="Transparent"
								   Margin="1,1,1,0"
								   RenderTransformOrigin="0.5,0.5" />
						<Polygon Fill="{StaticResource InputGlyphBrush}" 
								 Points="4,7 12,7 8,12" />
					</Grid>
					<ControlTemplate.Triggers>
						<Trigger Property="IsMouseOver" Value="True">
							<Setter TargetName="RectBackground" Property="Fill" Value="{StaticResource ButtonOverBackgroundBrush}"/>
						</Trigger>
						<Trigger Property="IsPressed" Value="True">
							<Setter TargetName="RectBackground" Property="Fill" Value="{StaticResource ButtonBackgroundBrush}"/>
							<Setter TargetName="RectShine" Property="RenderTransform">
								<Setter.Value>
									<RotateTransform Angle="180" CenterX="0" CenterY="0" />
								</Setter.Value>
							</Setter>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	
	<Style x:Key="TitlebarCloseButton" TargetType="{x:Type Button}">
		<Setter Property="Width" Value="16" />
		<Setter Property="Height" Value="16" />
		<Setter Property="Margin" Value="3,0,0,0" />
		<Setter Property="Focusable" Value="False" />
		<Setter Property="IsTabStop" Value="False" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Button}">
					<Grid>
						<Rectangle Name="RectBackground" 
								   RadiusX="5" RadiusY="5" 
								   Fill="{StaticResource CloseButtonBackgroundBrush}"
								   Stroke="{StaticResource CloseButtonBorderBrush}" 
								   StrokeThickness="1" />
						<Rectangle x:Name="RectShine" 
								   RadiusX="3" RadiusY="3" 
								   Fill="{StaticResource ButtonShineBrush}"
								   Stroke="Transparent"
								   Margin="1,1,1,0"
								   RenderTransformOrigin="0.5,0.5" />
						<Line Stroke="{StaticResource InputGlyphBrush}" StrokeThickness="2" X1="4" Y1="4" X2="12" Y2="12" />
						<Line Stroke="{StaticResource InputGlyphBrush}" StrokeThickness="2" X1="4" Y1="12" X2="12" Y2="4" />
					</Grid>
					<ControlTemplate.Triggers>
						<Trigger Property="IsMouseOver" Value="True">
							<Setter TargetName="RectBackground" Property="Fill" Value="{StaticResource CloseButtonOverBackgroundBrush}"/>
						</Trigger>
						<Trigger Property="IsPressed" Value="True">
							<Setter TargetName="RectBackground" Property="Fill" Value="{StaticResource CloseButtonBackgroundBrush}"/>
							<Setter TargetName="RectShine" Property="RenderTransform">
								<Setter.Value>
									<RotateTransform Angle="180" CenterX="0" CenterY="0" />
								</Setter.Value>
							</Setter>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	
	<Style x:Key="Window" TargetType="{x:Type Window}">
		<Setter Property="Background" Value="{StaticResource WindowBackgroundBrush}" />
		<Setter Property="BorderBrush" Value="{StaticResource WindowBorderBrush}" />
		<Setter Property="BorderThickness" Value="2" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Window}">
					<Border Background="{TemplateBinding Background}"
							BorderBrush="{TemplateBinding BorderBrush}"
							BorderThickness="{TemplateBinding BorderThickness}">
						<DockPanel>
							<Border Name="PART_Titlebar" 
									DockPanel.Dock="Top" 
									Height="Auto" 
									Background="{StaticResource TitlebarBackgroundBrush}">
								<Grid Margin="1">
									<Grid.ColumnDefinitions>
										<ColumnDefinition Width="Auto" />
										<ColumnDefinition Width="*" />
										<ColumnDefinition Width="Auto" />
									</Grid.ColumnDefinitions>
									<Image Grid.Column="0" 
										   Height="16" Margin="0,0,7,0" 
										   VerticalAlignment="Center"
										   Source="{TemplateBinding Icon}" />
									<TextBlock Grid.Column="1" 
											   Text="{TemplateBinding Title}" 
											   Foreground="{StaticResource WindowTextBrush}" 
											   VerticalAlignment="Center" 
											   FontWeight="Bold" />
									<StackPanel Grid.Column="2" 
												Orientation="Horizontal" 
												HorizontalAlignment="Right" 
												VerticalAlignment="Center">
										<Button Name="PART_MinimizeButton" Style="{StaticResource TitlebarMinimizeButton}" />
										<Button Name="PART_CloseButton" Style="{StaticResource TitlebarCloseButton}" />
									</StackPanel>
								</Grid>
							</Border>
							<Rectangle DockPanel.Dock="Top" 
									   Height="3" Width="Auto"
									   Fill="{StaticResource TitlebarShadowBrush}" />
							<AdornerDecorator>
								<ContentPresenter Margin="{TemplateBinding Margin}" />
							</AdornerDecorator>
						</DockPanel>
					</Border>
					<ControlTemplate.Triggers>
						<Trigger Property="ResizeMode" Value="NoResize">
							<Setter TargetName="PART_MinimizeButton" Property="Visibility" Value="Hidden" />
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	
	<!-- Main window and input styles -->
	<ObjectDataProvider x:Key="LoadSkinResource" 
						ObjectType="{x:Type local:CurrentSkinResource}" 
						MethodName="LoadResourceByName">
		<ObjectDataProvider.MethodParameters>
			<system:String>PrinceOfPersia2008Background.png</system:String>
		</ObjectDataProvider.MethodParameters>
	</ObjectDataProvider>
	<Style x:Key="GameBackground" TargetType="{x:Type Panel}" >
		<Setter Property="Background">
			<Setter.Value>
				<ImageBrush AlignmentX="Left" AlignmentY="Top" Stretch="None" TileMode="None">
					<ImageBrush.ImageSource>
						<BitmapImage BaseUri="{x:Null}" CacheOption="OnLoad">
							<BitmapImage.StreamSource>
								<Binding Source="{StaticResource LoadSkinResource}" />
							</BitmapImage.StreamSource>
						</BitmapImage>
					</ImageBrush.ImageSource>
				</ImageBrush>
			</Setter.Value>
		</Setter>
	</Style>
	
	<Style x:Key="GroupHeader">
		<Setter Property="Control.Foreground" Value="{StaticResource InputGroupTextBrush}" />
		<Setter Property="Control.FontWeight" Value="Bold" />
		<Setter Property="Control.Margin" Value="3,0,0,0" />
	</Style>

	<Style x:Key="ComboList" TargetType="{x:Type ListBox}" BasedOn="{StaticResource SelectorStyle}">
		<Style.Resources>
			<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="{StaticResource BlendSelectionBackgroundColor}" />
			<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="{StaticResource BlendSelectionInactiveBackgroundColor}" />
		</Style.Resources>
		<Setter Property="Background" Value="{StaticResource BlendDarkBackgroundBrush}" />
	</Style>
	
	
	<!-- Menu styles -->
	<Style TargetType="{x:Type Menu}">
		<Setter Property="Background" Value="{StaticResource MenuBackgroundBrush}" />
	</Style>
	
	<Style TargetType="{x:Type MenuItem}">
		<Style.Resources>
			<SolidColorBrush x:Key="{x:Static SystemColors.MenuBrushKey}" Color="{StaticResource InputBackgroundColor}" />
			<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="{StaticResource SelectionBackgroundColor}" />
			<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="{StaticResource InputTextColor}" />
		</Style.Resources>
		<Setter Property="Foreground" Value="{StaticResource InputTextBrush}" />
	</Style>

	<Style x:Key="{x:Static MenuItem.SeparatorStyleKey}" TargetType="{x:Type Separator}">
		<Setter Property="Background" Value="{StaticResource InputTextBrush}" />
	</Style>
	
	
	<!-- Control style overrides -->
	<Style TargetType="{x:Type Label}">
		<Setter Property="Foreground" Value="{StaticResource WindowTextBrush}" />
		<Setter Property="FontWeight" Value="Bold" />
	</Style>
	
	<Style TargetType="{x:Type ListBox}" BasedOn="{StaticResource SelectorStyle}" />
	
	<Style TargetType="{x:Type CheckBox}">
		<Setter Property="Background" Value="{StaticResource InputBackgroundBrush}" />
		<Setter Property="BorderBrush" Value="{StaticResource InputBorderBrush}" />
		<Setter Property="Foreground" Value="{StaticResource InputTextBrush}" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type CheckBox}">
					<BulletDecorator SnapsToDevicePixels="true" Background="Transparent">
						<BulletDecorator.Bullet>
							<Border x:Name="Border" 
									Width="14" Height="14"
									Background="{TemplateBinding Background}"
									BorderBrush="{TemplateBinding BorderBrush}"
									BorderThickness="{TemplateBinding BorderThickness}">
								<Path x:Name="Glyph"
									  SnapsToDevicePixels="False" 
									  HorizontalAlignment="Center" VerticalAlignment="Center"
									  Stroke="{StaticResource InputGlyphBrush}"
									  StrokeThickness="2"
									  Data="M 1 5 L 4 8 L 8 1" />
							</Border>
						</BulletDecorator.Bullet>
						<ContentPresenter 
							SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
							Margin="{TemplateBinding Padding}" 
							HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
							VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
							RecognizesAccessKey="True" />
					</BulletDecorator>
					<ControlTemplate.Triggers>
						<Trigger Property="IsChecked" Value="false">
							<Setter TargetName="Glyph" Property="Visibility" Value="Collapsed"/>
						</Trigger>
						<Trigger Property="IsMouseOver" Value="true">
							<Setter TargetName="Border" Property="BorderThickness" Value="2" />
						</Trigger>
						<Trigger Property="IsPressed" Value="true">
							<Setter TargetName="Border" Property="Background" Value="{StaticResource SelectionBackgroundBrush}" />
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	
	<Style TargetType="{x:Type RadioButton}">
		<Setter Property="Background" Value="{StaticResource InputBackgroundBrush}" />
		<Setter Property="BorderBrush" Value="{StaticResource InputBorderBrush}" />
		<Setter Property="Foreground" Value="{StaticResource InputTextBrush}" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type RadioButton}">
					<BulletDecorator SnapsToDevicePixels="true" Background="Transparent">
						<BulletDecorator.Bullet>
							<Canvas Width="14" Height="14">
								<Ellipse x:Name="Border"
										 Width="14" Height="14"
										 Fill="{TemplateBinding Background}"
										 Stroke="{TemplateBinding BorderBrush}"
										 StrokeThickness="{TemplateBinding BorderThickness}" />
								<Ellipse x:Name="Glyph"
										 Canvas.Left="4" Canvas.Top="4"
										 Width="6" Height="6"
										 Fill="{StaticResource InputGlyphBrush}" />
							</Canvas>
						</BulletDecorator.Bullet>
						<ContentPresenter 
							SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
							Margin="{TemplateBinding Padding}" 
							HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
							VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
							RecognizesAccessKey="True" />
					</BulletDecorator>
					<ControlTemplate.Triggers>
						<Trigger Property="HasContent" Value="true">
							<Setter Property="Padding" Value="2,0,0,0" />
						</Trigger>
						<Trigger Property="IsChecked" Value="false">
							<Setter TargetName="Glyph" Property="Visibility" Value="Collapsed"/>
						</Trigger>
						<Trigger Property="IsMouseOver" Value="true">
							<Setter TargetName="Border" Property="StrokeThickness" Value="2" />
						</Trigger>
						<Trigger Property="IsPressed" Value="true">
							<Setter TargetName="Border" Property="Fill" Value="{StaticResource SelectionBackgroundBrush}" />
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	
	<Style TargetType="{x:Type local:WatermarkTextBox}">
		<Setter Property="Background" Value="{StaticResource InputBackgroundBrush}" />
		<Setter Property="BorderBrush" Value="{StaticResource InputBorderBrush}" />
		<Setter Property="Foreground" Value="{StaticResource InputTextBrush}" />
		<Setter Property="WatermarkBrush" Value="{StaticResource WatermarkTextBrush}" />
	</Style>
	
	<Style TargetType="{x:Type GroupBox}">
		<Setter Property="BorderBrush" Value="{StaticResource InputBorderBrush}" />
		<Setter Property="HeaderTemplate">
			<Setter.Value>
				<DataTemplate>
					<TextBlock Text="{Binding}" Foreground="{StaticResource SelectionBackgroundBrush}" />
				</DataTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	
	<Style TargetType="{x:Type ToolTip}">
		<Setter Property="Background" Value="{StaticResource SelectionBackgroundBrush}" />
		<Setter Property="Foreground" Value="{StaticResource InputTextBrush}" />
		<Setter Property="Padding" Value="3,1,3,1" />
	</Style>
	
	<Style TargetType="{x:Type Button}">
		<Setter Property="Foreground" Value="{StaticResource ButtonTextBrush}"/>
		<Setter Property="Margin" Value="1"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Button}">
					<Grid>
						<Rectangle x:Name="RectBackground" 
								   RadiusX="6" RadiusY="6"
								   Fill="{StaticResource ButtonBackgroundBrush}" 
								   Stroke="{StaticResource ButtonBorderBrush}" 
								   StrokeThickness="0.35" />
						<Rectangle x:Name="RectShine" 
								   RadiusX="4" RadiusY="4" 
								   Fill="{StaticResource ButtonShineBrush}"
								   Stroke="Transparent"
								   Margin="1,1,1,0"
								   RenderTransformOrigin="0.5,0.5" />
						<ContentPresenter x:Name="Presenter"
							Margin="{TemplateBinding Padding}" 
							VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
							HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
							RecognizesAccessKey="true" 
							SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
					</Grid>
					<ControlTemplate.Triggers>
						<Trigger Property="IsEnabled" Value="False">
							<Setter Property="Foreground" Value="{StaticResource ButtonDisabledTextBrush}" />
							<Setter TargetName="RectBackground" Property="Fill" Value="{StaticResource ButtonDisabledBackgroundBrush}" />
						</Trigger>
						<Trigger Property="IsDefaulted" Value="True">
							<Setter TargetName="RectBackground" Property="StrokeThickness" Value="2"/>
						</Trigger>
						<Trigger Property="IsMouseOver" Value="True">
							<Setter TargetName="RectBackground" Property="Fill" Value="{StaticResource ButtonOverBackgroundBrush}"/>
						</Trigger>
						<Trigger Property="IsPressed" Value="True">
							<Setter TargetName="RectBackground" Property="Fill" Value="{StaticResource ButtonBackgroundBrush}"/>
							<Setter TargetName="RectShine" Property="RenderTransform">
								<Setter.Value>
									<RotateTransform Angle="180" CenterX="0" CenterY="0" />
								</Setter.Value>
							</Setter>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	
	<Style x:Key="ScrollButton" TargetType="{x:Type ButtonBase}">
		<Setter Property="OverridesDefaultStyle" Value="True"/>
		<Setter Property="Focusable" Value="False"/>
		<Setter Property="IsTabStop" Value="False"/>
		<Setter Property="HorizontalContentAlignment" Value="Center" />
		<Setter Property="VerticalContentAlignment" Value="Center" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type ButtonBase}">
					<Grid>
						<Rectangle x:Name="RectBackground" 
								   RadiusX="3" RadiusY="3"
								   Fill="{StaticResource ButtonBackgroundBrush}" 
								   Stroke="{StaticResource ButtonBorderBrush}" 
								   StrokeThickness="1" />
						<Rectangle x:Name="RectShine" 
								   RadiusX="1" RadiusY="1" 
								   Fill="{StaticResource ButtonShineBrush}"
								   Stroke="Transparent"
								   Margin="1,1,1,0"
								   RenderTransformOrigin="0.5,0.5" />
						<ContentPresenter x:Name="Presenter"
							Margin="{TemplateBinding Padding}" 
							VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
							HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
							SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
					</Grid>
					<ControlTemplate.Triggers>
						<Trigger Property="IsEnabled" Value="False">
							<Setter Property="Foreground" Value="{StaticResource ButtonDisabledTextBrush}" />
							<Setter TargetName="RectBackground" Property="Fill" Value="{StaticResource ButtonDisabledBackgroundBrush}" />
						</Trigger>
						<Trigger Property="IsMouseOver" Value="True">
							<Setter TargetName="RectBackground" Property="Fill" Value="{StaticResource ButtonOverBackgroundBrush}"/>
						</Trigger>
						<Trigger Property="IsPressed" Value="True">
							<Setter TargetName="RectBackground" Property="Fill" Value="{StaticResource ButtonBackgroundBrush}"/>
							<Setter TargetName="RectShine" Property="RenderTransform">
								<Setter.Value>
									<RotateTransform Angle="180" CenterX="0" CenterY="0" />
								</Setter.Value>
							</Setter>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	
	<Style x:Key="ScrollThumb" TargetType="{x:Type Thumb}">
		<Setter Property="OverridesDefaultStyle" Value="True"/>
		<Setter Property="IsTabStop" Value="False"/>
		<Setter Property="HorizontalContentAlignment" Value="Center" />
		<Setter Property="VerticalContentAlignment" Value="Center" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Thumb}">
					<Grid>
						<Rectangle x:Name="RectBackground" 
								   RadiusX="3" RadiusY="3"
								   Fill="{StaticResource ButtonBackgroundBrush}" 
								   Stroke="{StaticResource ButtonBorderBrush}" 
								   StrokeThickness="1" />
						<Rectangle x:Name="RectShine" 
								   RadiusX="1" RadiusY="1" 
								   Fill="{StaticResource ThumbShineBrush}"
								   Stroke="Transparent"
								   Margin="1,1,0,1"
								   RenderTransformOrigin="0.5,0.5" />
					</Grid>
					<ControlTemplate.Triggers>
						<Trigger Property="IsEnabled" Value="False">
							<Setter Property="Foreground" Value="{StaticResource ButtonDisabledTextBrush}" />
							<Setter TargetName="RectBackground" Property="Fill" Value="{StaticResource ButtonDisabledBackgroundBrush}" />
						</Trigger>
						<Trigger Property="IsMouseOver" Value="True">
							<Setter TargetName="RectBackground" Property="Stroke" Value="{StaticResource HighlightBorderBrush}" />
						</Trigger>
						<Trigger Property="IsDragging" Value="True">
							<Setter TargetName="RectShine" Property="RenderTransform">
								<Setter.Value>
									<RotateTransform Angle="180" CenterX="0" CenterY="0" />
								</Setter.Value>
							</Setter>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style x:Key="ScrollTrackButton" TargetType="{x:Type RepeatButton}">
		<Setter Property="OverridesDefaultStyle" Value="True"/>
		<Setter Property="Background" Value="#00FFFFFF"/>
		<Setter Property="Focusable" Value="False"/>
		<Setter Property="IsTabStop" Value="False"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type RepeatButton}">
					<Rectangle x:Name="Bg" 
							   Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" 
							   Fill="{TemplateBinding Background}"/>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style TargetType="{x:Type ScrollBar}">
		<Setter Property="Background" Value="{StaticResource InputBackgroundBrush}" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type ScrollBar}">
					<Grid SnapsToDevicePixels="True" Background="{TemplateBinding Background}">
						<Grid.RowDefinitions>
							<RowDefinition MaxHeight="{DynamicResource {x:Static SystemParameters.VerticalScrollBarButtonHeightKey}}"/>
							<RowDefinition Height="1E-05*"/>
							<RowDefinition MaxHeight="{DynamicResource {x:Static SystemParameters.VerticalScrollBarButtonHeightKey}}"/>
						</Grid.RowDefinitions>
						<RepeatButton Grid.Row="0" 
									  Command="ScrollBar.LineUpCommand" 
									  Style="{StaticResource ScrollButton}">
							<Polyline Stroke="{StaticResource InputGlyphBrush}" 
									  StrokeThickness="2"
									  Points="0,4 4,0 8,4" />
						</RepeatButton>
						<Track x:Name="PART_Track" Grid.Row="1" IsDirectionReversed="True">
							<Track.Thumb>
								<Thumb Style="{StaticResource ScrollThumb}" />
							</Track.Thumb>
							<Track.IncreaseRepeatButton>
								<RepeatButton Command="ScrollBar.PageDownCommand" Style="{StaticResource ScrollTrackButton}" />
							</Track.IncreaseRepeatButton>
							<Track.DecreaseRepeatButton>
								<RepeatButton Command="ScrollBar.PageUpCommand" Style="{StaticResource ScrollTrackButton}" />
							</Track.DecreaseRepeatButton>
						</Track>
						<RepeatButton Grid.Row="2" 
									  Command="ScrollBar.LineDownCommand" 
									  Style="{StaticResource ScrollButton}">
							<Polyline Stroke="{StaticResource InputGlyphBrush}" 
									  StrokeThickness="2"
									  Points="0,0 4,4 8,0" />
						</RepeatButton>
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
		<Style.Triggers>
			<Trigger Property="IsEnabled" Value="False">
				<Setter Property="Background" Value="{StaticResource DisabledInputBackgroundBrush}" />
			</Trigger>
		</Style.Triggers>
	</Style>
	
	<Style x:Key="DropDownButton" TargetType="{x:Type ToggleButton}">
		<Setter Property="MinWidth" Value="0"/>
		<Setter Property="MinHeight" Value="0"/>
		<Setter Property="Width" Value="NaN"/>
		<Setter Property="Height" Value="NaN"/>
		<Setter Property="Background" Value="#00FFFFFF"/>
		<Setter Property="Focusable" Value="False"/>
		<Setter Property="ClickMode" Value="Press"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type ToggleButton}">
					<Grid SnapsToDevicePixels="True" Background="{TemplateBinding Background}">
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="*"/>
							<ColumnDefinition Width="Auto" SharedSizeGroup="ComboBoxButton"/>
						</Grid.ColumnDefinitions>
						<Grid Grid.Column="1"
							  Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}">
							<Rectangle x:Name="RectBackground" 
									   RadiusX="3" RadiusY="3"
									   Fill="{StaticResource ButtonBackgroundBrush}" 
									   Stroke="{StaticResource ButtonBorderBrush}" 
									   StrokeThickness="1" />
							<Rectangle x:Name="RectShine" 
									   RadiusX="1" RadiusY="1" 
									   Fill="{StaticResource ButtonShineBrush}"
									   Stroke="Transparent"
									   Margin="1,1,1,0"
									   RenderTransformOrigin="0.5,0.5" />
							<Polyline Stroke="{StaticResource InputGlyphBrush}" 
									  StrokeThickness="2"
									  HorizontalAlignment="Center"
									  VerticalAlignment="Center"
									  Points="0,0 4,4 8,0" />
						</Grid>
					</Grid>
					<ControlTemplate.Triggers>
						<Trigger Property="IsEnabled" Value="False">
							<Setter Property="Foreground" Value="{StaticResource ButtonDisabledTextBrush}" />
							<Setter TargetName="RectBackground" Property="Fill" Value="{StaticResource ButtonDisabledBackgroundBrush}" />
						</Trigger>
						<Trigger Property="IsMouseOver" Value="True">
							<Setter TargetName="RectBackground" Property="Fill" Value="{StaticResource ButtonOverBackgroundBrush}"/>
						</Trigger>
						<Trigger Property="IsChecked" Value="True">
							<Setter TargetName="RectBackground" Property="Fill" Value="{StaticResource ButtonBackgroundBrush}"/>
							<Setter TargetName="RectShine" Property="RenderTransform">
								<Setter.Value>
									<RotateTransform Angle="180" CenterX="0" CenterY="0" />
								</Setter.Value>
							</Setter>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	
	<Style TargetType="{x:Type ComboBox}" BasedOn="{StaticResource SelectorStyle}">
		<Setter Property="Background" Value="{StaticResource InputBackgroundBrush}" />
		<Setter Property="BorderBrush" Value="{StaticResource InputBorderBrush}" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type ComboBox}">
					<Grid SnapsToDevicePixels="True">
						<Border x:Name="Bd" 
								Background="{TemplateBinding Background}" 
								BorderBrush="{TemplateBinding BorderBrush}" 
								BorderThickness="{TemplateBinding BorderThickness}" 
								Padding="1,1,1,1">
							<Grid Grid.IsSharedSizeScope="True">
								<Grid.ColumnDefinitions>
									<ColumnDefinition Width="1"/>
									<ColumnDefinition Width="*"/>
									<ColumnDefinition Width="Auto" SharedSizeGroup="ComboBoxButton" />
								</Grid.ColumnDefinitions>
								<Border x:Name="SelectedItemBorder" 
										Grid.Column="0"
										Grid.ColumnSpan="2" 
										Margin="{TemplateBinding Padding}" />
								<ContentPresenter Grid.Column="1" 
												  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
												  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
												  VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
												  Margin="{TemplateBinding Padding}" 
												  Content="{TemplateBinding SelectionBoxItem}" 
												  ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
												  ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" />
								<ToggleButton Grid.ColumnSpan="3" 
											  ClickMode="Press"
											  IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
											  Style="{StaticResource DropDownButton}" />
							</Grid>
						</Border>
						<Popup x:Name="PART_Popup" 
							   Focusable="False" 
							   AllowsTransparency="True" 
							   IsOpen="{Binding Path=IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}" 
							   Placement="Bottom" 
							   PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}">
							<aero:SystemDropShadowChrome 
								x:Name="Shdw"
								MaxHeight="{TemplateBinding MaxDropDownHeight}" 
								MinWidth="{TemplateBinding ActualWidth}" 
								Color="Transparent">
								<Border x:Name="DropDownBorder" 
										Background="{TemplateBinding Background}" 
										BorderBrush="{TemplateBinding BorderBrush}" 
										BorderThickness="{TemplateBinding BorderThickness}">
									<ScrollViewer>
										<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
														KeyboardNavigation.DirectionalNavigation="Contained" />
									</ScrollViewer>
								</Border>
							</aero:SystemDropShadowChrome>
						</Popup>
					</Grid>
					<ControlTemplate.Triggers>
						<MultiTrigger>
							<MultiTrigger.Conditions>
								<Condition Property="IsSelectionBoxHighlighted" Value="True" />
								<Condition Property="IsDropDownOpen" Value="False" />
							</MultiTrigger.Conditions>
							<Setter Property="Foreground" Value="{StaticResource InputTextBrush}" />
						</MultiTrigger>
						<Trigger Property="IsSelectionBoxHighlighted" Value="True">
							<Setter TargetName="SelectedItemBorder" Property="Background" Value="{StaticResource SelectionBackgroundBrush}" />
						</Trigger>
						<Trigger SourceName="PART_Popup" Property="HasDropShadow" Value="True">
							<Setter TargetName="Shdw" Property="Margin" Value="0,0,5,5" />
							<Setter TargetName="Shdw" Property="Color" Value="#71000000" />
						</Trigger>
						<Trigger Property="HasItems" Value="False">
							<Setter TargetName="DropDownBorder" Property="MinHeight" Value="95" />
						</Trigger>
						<Trigger Property="IsEnabled" Value="False">
							<Setter TargetName="Bd" Property="Background" Value="{StaticResource DisabledInputBackgroundBrush}" />
						</Trigger>
						<Trigger Property="IsGrouping" Value="True">
							<Setter Property="ScrollViewer.CanContentScroll" Value="False" />
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
    
</ResourceDictionary>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Matt Sollars
Web Developer
United States United States
I began programming on my Commodore 64 at around the age of 12. After migrating to DOS and then Windows, I decided to take on the Web. Several languages and platforms later, I have settled in with .NET nicely. I am currently the owner of a software consulting company and lead application developer for a learning-based technology consultation company.
 
The love of a finished application is usually at war with the desire to improve it as soon as it's released (they're never really finished).

| Advertise | Privacy | Mobile
Web04 | 2.8.140916.1 | Last Updated 23 May 2009
Article Copyright 2009 by Matt Sollars
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid