<Page xmlns:local="clr-namespace:ForzaUI"
	  xmlns:System="clr-namespace:System;assembly=mscorlib"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"  
	  x:Class="ForzaUI.A_Billboard"
      mc:Ignorable="d"
      DataContext="{Binding RelativeSource={RelativeSource Self}}"
      Width="{Binding TargetWidth}"
      Height="{Binding TargetHeight}">
    <Grid >
        <MediaElement UnloadedBehavior="Close"
                      Loop="True"
                      HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                      x:Name="Video" 
                      local:FZMediaElementExtension.Loop="True"
                      ZPanel.TransformOrigin="0.5,0.5">
            <ZPanel.Transform>
                <!-- We use a correction scale to ensure the video fills the 0..1 UVs -->
                <!-- This might be stretched in UI space but is corrected when mapped to the model -->
                <!-- This way we can adjust the amount of memory used for the internal render target without
                     needing to manually match up resolutions/aspect in the scene, model and render target -->
                <ScaleTransform3D ScaleX="{Binding AspectCorrection}"/>
            </ZPanel.Transform>
        </MediaElement>
    </Grid>
</Page>
