<?xml version="1.0" encoding="utf-8"?>
<Mcml xmlns ="http://schemas.microsoft.com/2008/mcml" xmlns:cor="assembly://MsCorLib/System" xmlns:me="Me">
<!--general purpose command button in Windows 7 Media Center style-->
<UI Name="Button">
<Locals>
<!--handles mouse click, remote select and keyboard enter events-->
<ClickHandler Name="Clicker"/>
</Locals>
<Properties>
<!--required properties-->
<ICommand Name="Model" ICommand="$Required"/>
<!--options-->
<cor:Boolean Name="IsNavigatingCommand" Boolean="true"/>
<Size Name="TileSize" Size="250, 51"/>
<!--fonts-->
<Font Name="Font" FontName="Segoe Media Center Semibold" FontSize="20" />
<!--images-->
<Image Name="LabelBackground" Source="res://ehres!Button.Label.Background.png" NineGrid="7, 7, 7, 7"/>
<Image Name="LabelBackgroundFocus" Source="res://ehres!Button.Label.Background.Focus.png" NineGrid="7, 7, 7, 7"/>
<Image Name="NoFocusImage" Source="res://ehres!Common.Button.NoFocus.Full.png" NineGrid="20,12,20,10"/>
<Image Name="FocusImage" Source="res://ehres!Common.Button.Left.Focus.png" NineGrid="20,12,20,10"/>
<Image Name="DisabledImage" Source="res://ehres!Common.Button.Disabled.Full.png" NineGrid="20,12,20,10"/>
<Image Name="FocusOverlayImage" Source="res://ehres!Common.Button.Left.FocusOverlay.png"/>
<Image Name="PressedImage" Source="res://ehres!Common.Button.PressedHighlight.png"/>
<!--colors-->
<Color Name="NoFocusColor" Color="255, 151, 217, 255"/>
<Color Name="FocusColor" Color="255, 242, 242, 242"/>
<Color Name="DisabledColor" Color="102, 151, 217, 255"/>
<!--sounds-->
<Sound Name="DefaultNavigationSound" Sound="res://ehres!Select_a.wav" />
<Sound Name="DefaultNonNavigationSound" Sound="res://ehres!MiniSelect_a.wav" />
</Properties>
<Rules>
<!--defaults-->
<Default Target="[Input.KeyInteractive]" Value="true" />
<!--play navigation sound if button's command causes navigation-->
<Rule>
<Conditions>
<Modified Source="[Clicker.Invoked]"/>
<Equality Source="[IsNavigatingCommand]" Value="true"/>
</Conditions>
<Actions>
<PlaySound Sound="[DefaultNavigationSound]" />
</Actions>
</Rule>
<!--play non-navigation sound if button's command doesn't cause navigation-->
<Rule>
<Conditions>
<Modified Source="[Clicker.Invoked]"/>
<Equality Source="[IsNavigatingCommand]" Value="false"/>
</Conditions>
<Actions>
<PlaySound Sound="[DefaultNonNavigationSound]" />
</Actions>
</Rule>
<!--disable button when command unavailable-->
<Binding Source="[Model.Available]" Target="[Input.Enabled]"/>
<!--change colors and image on disable-->
<Condition Source="[Input.Enabled]" SourceValue="false" Target="[Label.Color]" Value="[DisabledColor]"/>
<Condition Source="[Input.Enabled]" SourceValue="false" Target="[Background.Content]" Value="[DisabledImage]"/>
<!--change text color and images on focus-->
<Condition Source="[Input.KeyFocus]" SourceValue="true" Target="[Label.Color]" Value="[FocusColor]" />
<Condition Source="[Input.KeyFocus]" SourceValue="true" Target="[LabelBackgroundGraphic.Content]" Value="[LabelBackgroundFocus]" />
<Condition Source="[Input.KeyFocus]" SourceValue="true" Target="[Background.Content]" Value="[FocusImage]" />
<!--show focus overlay and play focus sound on focus-->
<Rule>
<Conditions>
<Equality Source="[Input.KeyFocus]" ConditionOp="ChangedTo" Value="true"/>
</Conditions>
<Actions>
<Set Target="[FocusOverlay.Visible]" Value="true"/>
<PlaySound Sound="res://ehres!Focus_a.wav" />
</Actions>
</Rule>
<!--highlight appears while clicking button-->
<Binding Source="[Clicker.Clicking]" Target="[Highlight.Visible]"/>
<!--apply size property-->
<Binding Source="[TileSize]" Target="[Root.MaximumSize]"/>
<Binding Source="[TileSize]" Target="[Background.MinimumSize]"/>
<!--bind button text to command description-->
<Binding Source="[Model.Description]" Target="[Label.Content]"/>
<!--invoke the command when the button is clicked-->
<Rule>
<Conditions>
<Modified Source="[Clicker.Invoked]"/>
</Conditions>
<Actions>
<Invoke Target="[Model.Invoke]" InvokePolicy="AsynchronousLowPri"/>
</Actions>
</Rule>
</Rules>
<Content>
<Panel Name="Root" MouseInteractive="true">
<Children>
<!--contains the button image and text-->
<Panel Name="LabelScalePanel" Layout="Dock">
<Children>
<Panel Name="LabelPanel" Layout="Anchor" Margins="16,0,16,0">
<LayoutInput>
<DockLayoutInput Position="Client" Alignment="Center"/>
</LayoutInput>
<Children>
<Text Name="Label" Color="[NoFocusColor]" Font="[Font]">
<LayoutInput>
<AnchorLayoutInput Vertical="Center" Horizontal="Near"/>
</LayoutInput>
</Text>
<Graphic Name="LabelBackgroundGraphic" Content="[LabelBackground]">
<LayoutInput>
<AnchorLayoutInput Left="Label,0,-8" Top="Label,0,-4" Right="Label,1,8" Bottom="Label,1,4" ContributesToWidth="false" ContributesToHeight="false"/>
</LayoutInput>
</Graphic>
</Children>
</Panel>
</Children>
</Panel>
<!--contains the (animated) button highlight-->
<Clip FadeSize="20" Layout="Fill">
<Children>
<Graphic Name="Highlight" Content="[PressedImage]">
<Animations>
<TransformByAttributeAnimation Filter="Position" Attribute="Width" Magnitude="1.0">
<Source>
<Animation Type="Show">
<Keyframes>
<PositionKeyframe Time="0.00" Value="-1.0,0,0" RelativeTo="Final"/>
<PositionKeyframe Time="0.10" Value="0.00,0,0" RelativeTo="Final"/>
<PositionKeyframe Time="0.18" Value="0.35,0,0" RelativeTo="Final"/>
<PositionKeyframe Time="0.35" Value="0.55,0,0" RelativeTo="Final"/>
<PositionKeyframe Time="0.60" Value="1.25,0,0" RelativeTo="Final"/>
<PositionKeyframe Time="0.70" Value="1.25,0,0" RelativeTo="Final"/>
<AlphaKeyframe Time="0.00" Value="0.00" RelativeTo="Absolute"/>
<AlphaKeyframe Time="0.05" Value="0.75" RelativeTo="Absolute"/>
<AlphaKeyframe Time="0.17" Value="0.75" RelativeTo="Absolute"/>
<AlphaKeyframe Time="0.40" Value="0.00" RelativeTo="Absolute"/>
</Keyframes>
</Animation>
</Source>
</TransformByAttributeAnimation>
<TransformByAttributeAnimation Filter="Position" Attribute="Width" Magnitude="1.0">
<Source>
<Animation Type="Hide">
<Keyframes>
<PositionKeyframe Time="0.00" Value="0.0,0,0" RelativeTo="Current"/>
<PositionKeyframe Time="0.10" Value="1.0,0,0" RelativeTo="Final"/>
<AlphaKeyframe Time="0.00" RelativeTo="Current"/>
<AlphaKeyframe Time="0.10" Value="0.0" RelativeTo="Absolute"/>
</Keyframes>
</Animation>
</Source>
</TransformByAttributeAnimation>
</Animations>
</Graphic>
</Children>
</Clip>
<!--contains the (slowly pulsing) focus overlay-->
<Graphic Name="FocusOverlay" Layout="Fill" Content="[FocusOverlayImage]" Visible="false">
<Animations>
<Animation Loop="-1" Type="Idle">
<Keyframes>
<AlphaKeyframe Time="0.0" Value="0.0" Interpolation="SCurve" RelativeTo="Absolute"/>
<AlphaKeyframe Time="1.5" Value="0.63" Interpolation="SCurve" RelativeTo="Absolute"/>
<AlphaKeyframe Time="3.0" Value="0.0" RelativeTo="Absolute"/>
</Keyframes>
</Animation>
</Animations>
</Graphic>
<!--the button background image-->
<Graphic Name="Background" Layout="Fill" Content="[NoFocusImage]" />
</Children>
</Panel>
</Content>
</UI>
</Mcml>