<Page x:Class="ForzaUI.TestMenu" 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" mc:Ignorable="d" xmlns:System="clr-namespace:System;assembly=mscorlib" xmlns:local="clr-namespace:ForzaUI;assembly=" Style="{StaticResource A_Style_Page_Generic}">
    <Page.Resources>
        <DynamicDataSource x:Key="effects">
            <DynamicDataItem Name="None" Value="{x:Null}"/>
            <DynamicDataItem Name="TextureMaskEffect">
                <DynamicDataItem.Value>
                    <TextureMaskEffect />
                </DynamicDataItem.Value>
            </DynamicDataItem>
            <DynamicDataItem Name="RadialBlurEffect">
                <DynamicDataItem.Value>
                    <RadialBlurEffect Quality="Radial32"/>
                </DynamicDataItem.Value>
            </DynamicDataItem>
            <DynamicDataItem Name="OutlineEffect">
                <DynamicDataItem.Value>
                    <OutlineEffect Color="#0f0" />
                </DynamicDataItem.Value>
            </DynamicDataItem>
            <DynamicDataItem Name="GlowEffect">
                <DynamicDataItem.Value>
                    <GlowEffect BlurSize="2" BlurQuality="KawaseLow" />
                </DynamicDataItem.Value>
            </DynamicDataItem>
            <DynamicDataItem Name="HardShadow">
                <DynamicDataItem.Value>
                    <DropShadowEffect ShadowDepth="5" BlurRadius="0" Color="#80000000"/>
                </DynamicDataItem.Value>
            </DynamicDataItem>
            <DynamicDataItem Name="SoftShadow">
                <DynamicDataItem.Value>
                    <DropShadowEffect ShadowDepth="5" BlurRadius="5" Color="#80000000"/>
                </DynamicDataItem.Value>
            </DynamicDataItem>
            <DynamicDataItem Name="BlurEffect">
                <DynamicDataItem.Value>
                    <BlurEffect Radius="5"/>
                </DynamicDataItem.Value>
            </DynamicDataItem>
            <DynamicDataItem Name="TintEffect">
                <DynamicDataItem.Value>
                    <TintEffect Tint="#FF80FF80"/>
                </DynamicDataItem.Value>
            </DynamicDataItem>
            <DynamicDataItem Name="SaturationEffect">
                <DynamicDataItem.Value>
                    <SaturationEffect Saturation="0"/>
                </DynamicDataItem.Value>
            </DynamicDataItem>
            <DynamicDataItem Name="CircularProgressEffect">
                <DynamicDataItem.Value>
                    <CircularProgressEffect FillProgress="0.66" />
                </DynamicDataItem.Value>
            </DynamicDataItem>
            <DynamicDataItem Name="LinearToSRGBEffect">
                <DynamicDataItem.Value>
                    <LinearToSRGBEffect />
                </DynamicDataItem.Value>
            </DynamicDataItem>
            <DynamicDataItem Name="GlassEffect">
                <DynamicDataItem.Value>
                    <GlassEffect />
                </DynamicDataItem.Value>
            </DynamicDataItem>
            <DynamicDataItem Name="MotionBlurEffect">
                <DynamicDataItem.Value>
                    <MotionBlurEffect />
                </DynamicDataItem.Value>
            </DynamicDataItem>
        </DynamicDataSource>
        <LinearTransformConverter x:Key="AnimationOffsetConverter" Scale="50" Sub="25"/>
        <ExponentialEase x:Key="AnimationEase" EasingMode="EaseInOut"/>
    </Page.Resources>
    <Page.Triggers>
        <EventTrigger RoutedEvent="FrameworkElement.Loaded">
            <BeginStoryboard>
                <BeginStoryboard.Storyboard>
                    <Storyboard RepeatBehavior="Forever">
                        <DoubleAnimation Storyboard.TargetProperty="(BindingProxy.AlwaysValidNumeric)"
                                         Storyboard.TargetName="LayoutRoot"
                                         From="0"
                                         To="1"
                                         Duration="0:0:0.25"
                                         AutoReverse="True"
                                         EasingFunction="{StaticResource AnimationEase}"/>
                    </Storyboard>
                </BeginStoryboard.Storyboard>
            </BeginStoryboard>
        </EventTrigger>
    </Page.Triggers>
    <Grid x:Name="LayoutRoot">
        <ItemsControl ItemsSource="{StaticResource effects}">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <UniformGrid Columns="{Binding Count, Source={StaticResource effects}}" IsItemsHost="True"/>
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>

            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <UniformGrid Columns="1" Margin="20">
                        <FZTextBlock HorizontalAlignment="Center" VerticalAlignment="Center" CapHeight="22" Color="#fff"  Text="{Binding Name}"/>
                        <Rectangle Margin="0,20" Fill="#f0f" Effect="{Binding Value}"/>
                        <FZMaterial Margin="0,20" Preset="{Roundtangle CornerRadius=10}" Margin="0,5" Color="#f0f" Effect="{Binding Value}" />
                        <Decorator Effect="{Binding Value}">
                            <Viewbox Margin="0,5" >
                                <TextBlock Text="Hello, world!" Foreground="#f0f"  FontSize="5"  HorizontalAlignment="Center" VerticalAlignment="Center" />
                            </Viewbox>
                        </Decorator>
                        <Decorator Effect="{Binding Value}">
                            <Viewbox Margin="0,5">
                                <FZTextBlock  Text="Hello, world!" Color="#f0f" CapHeight="5" HorizontalAlignment="Center" VerticalAlignment="Center" />
                            </Viewbox>
                        </Decorator>
                    </UniformGrid>
                    <DataTemplate.Triggers>
                        <DataTrigger Binding="{Binding Name}" Value="MotionBlurEffect">
                            <Setter Property="RenderTransform">
                                <Setter.Value>
                                    <TranslateTransform Y="{Binding (BindingProxy.AlwaysValidNumeric), ElementName=LayoutRoot, Converter={StaticResource AnimationOffsetConverter}}"/>
                                </Setter.Value>
                            </Setter>
                        </DataTrigger>
                    </DataTemplate.Triggers>
                </DataTemplate>
            </ItemsControl.ItemTemplate>

        </ItemsControl>
    </Grid>
</Page>
