Browse Source

Merge pull request #2041 from AvaloniaUI/fix-renderdemo-xaml

Fix RenderDemo's AnimationsPage crash
pull/2043/head
danwalmsley 8 years ago
committed by GitHub
parent
commit
7a6cf80fe1
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      samples/RenderDemo/MainWindow.xaml
  2. 28
      samples/RenderDemo/Pages/AnimationsPage.xaml
  3. 12
      samples/RenderDemo/Pages/ClippingPage.xaml
  4. 4
      samples/RenderDemo/Pages/DrawingPage.xaml

18
samples/RenderDemo/MainWindow.xaml

@ -8,12 +8,13 @@
<MenuItem Header="Rendering"> <MenuItem Header="Rendering">
<MenuItem Header="Draw Dirty Rects" Command="{Binding ToggleDrawDirtyRects}"> <MenuItem Header="Draw Dirty Rects" Command="{Binding ToggleDrawDirtyRects}">
<MenuItem.Icon> <MenuItem.Icon>
<CheckBox BorderThickness="0" <CheckBox BorderThickness="0"
IsHitTestVisible="False" IsHitTestVisible="False"
IsChecked="{Binding DrawDirtyRects}"/> IsChecked="{Binding DrawDirtyRects}"/>
</MenuItem.Icon> </MenuItem.Icon>
</MenuItem> </MenuItem>
<MenuItem Header="Draw FPS" Command="{Binding ToggleDrawFps}"> <MenuItem Header="Draw FPS"
Command="{Binding ToggleDrawFps}">
<MenuItem.Icon> <MenuItem.Icon>
<CheckBox BorderThickness="0" <CheckBox BorderThickness="0"
IsHitTestVisible="False" IsHitTestVisible="False"
@ -22,14 +23,19 @@
</MenuItem> </MenuItem>
</MenuItem> </MenuItem>
</Menu> </Menu>
<TabControl Classes="sidebar"> <TabControl Classes="sidebar">
<TabControl.PageTransition> <TabControl.PageTransition>
<CrossFade Duration="0.25"/> <CrossFade Duration="0.25"/>
</TabControl.PageTransition> </TabControl.PageTransition>
<TabItem Header="Animations"><pages:AnimationsPage/></TabItem> <TabItem Header="Animations">
<TabItem Header="Clipping"><pages:ClippingPage/></TabItem> <pages:AnimationsPage/>
<TabItem Header="Drawing"><pages:DrawingPage/></TabItem> </TabItem>
<TabItem Header="Clipping">
<pages:ClippingPage/>
</TabItem>
<TabItem Header="Drawing">
<pages:DrawingPage/>
</TabItem>
</TabControl> </TabControl>
</DockPanel> </DockPanel>
</Window> </Window>

28
samples/RenderDemo/Pages/AnimationsPage.xaml

@ -1,12 +1,12 @@
<UserControl <UserControl
xmlns="https://github.com/avaloniaui" xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<UserControl.Styles> <UserControl.Styles>
<Styles> <Styles>
<Styles.Resources> <Styles.Resources>
<Template x:Key="Acorn"> <Template x:Key="Acorn">
<Path Fill="White" Stretch="Uniform" <Path Fill="White" Stretch="Uniform"
Data="F1 M 16.6309,18.6563C 17.1309, Data="F1 M 16.6309,18.6563C 17.1309,
8.15625 29.8809,14.1563 29.8809, 8.15625 29.8809,14.1563 29.8809,
14.1563C 30.8809,11.1563 34.1308, 14.1563C 30.8809,11.1563 34.1308,
11.4063 34.1308,11.4063C 33.5,12 11.4063 34.1308,11.4063C 33.5,12
@ -42,17 +42,17 @@
</Style> </Style>
<Style Selector="Border.Rect1:pointerover"> <Style Selector="Border.Rect1:pointerover">
<Style.Animations> <Style.Animations>
<Animation Duration="0:0:2.5" <Animation Duration="0:0:2.5"
RepeatCount="4" RepeatCount="4"
FillMode="None" FillMode="None"
PlaybackDirection="AlternateReverse" PlaybackDirection="AlternateReverse"
Easing="SineEaseInOut"> Easing="SineEaseInOut">
<KeyFrame Cue="20%"> <KeyFrame Cue="20%">
<Setter Property="RotateTransform.Angle" Value="45"/> <Setter Property="RotateTransform.Angle" Value="45"/>
</KeyFrame> </KeyFrame>
<KeyFrame Cue="50%"> <KeyFrame Cue="50%">
<Setter Property="ScaleTransform.ScaleX" Value="1.5"/> <Setter Property="ScaleTransform.ScaleX" Value="1.5"/>
</KeyFrame> </KeyFrame>
<KeyFrame Cue="80%"> <KeyFrame Cue="80%">
<Setter Property="RotateTransform.Angle" Value="120"/> <Setter Property="RotateTransform.Angle" Value="120"/>
</KeyFrame> </KeyFrame>
@ -70,7 +70,6 @@
</Style.Animations> </Style.Animations>
</Style> </Style>
<Style Selector="Border.Rect3"> <Style Selector="Border.Rect3">
<Setter Property="Child" Value="{StaticResource Heart}"/>
<Style.Animations> <Style.Animations>
<Animation Duration="0:0:0.5" <Animation Duration="0:0:0.5"
Easing="QuadraticEaseInOut" Easing="QuadraticEaseInOut"
@ -79,12 +78,13 @@
<Setter Property="ScaleTransform.ScaleX" Value="0.8"/> <Setter Property="ScaleTransform.ScaleX" Value="0.8"/>
<Setter Property="ScaleTransform.ScaleY" Value="0.8"/> <Setter Property="ScaleTransform.ScaleY" Value="0.8"/>
</KeyFrame> </KeyFrame>
</Animation> </Animation>
</Style.Animations> </Style.Animations>
<Setter Property="Child" Value="{StaticResource Heart}"/>
</Style> </Style>
<Style Selector="Border.Rect4:pointerover"> <Style Selector="Border.Rect4:pointerover">
<Style.Animations> <Style.Animations>
<Animation Duration="0:0:3" Easing="BounceEaseInOut"> <Animation Duration="0:0:3" Easing="BounceEaseInOut">
<KeyFrame Cue="48%"> <KeyFrame Cue="48%">
<Setter Property="TranslateTransform.Y" Value="-100"/> <Setter Property="TranslateTransform.Y" Value="-100"/>
</KeyFrame> </KeyFrame>
@ -108,7 +108,7 @@
<Grid> <Grid>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" ClipToBounds="False"> <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" ClipToBounds="False">
<StackPanel.Clock> <StackPanel.Clock>
<Clock /> <Clock />
</StackPanel.Clock> </StackPanel.Clock>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center"> <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<TextBlock VerticalAlignment="Center">Hover to activate Transform Keyframe Animations.</TextBlock> <TextBlock VerticalAlignment="Center">Hover to activate Transform Keyframe Animations.</TextBlock>

12
samples/RenderDemo/Pages/ClippingPage.xaml

@ -1,5 +1,5 @@
<UserControl <UserControl
xmlns="https://github.com/avaloniaui"> xmlns="https://github.com/avaloniaui">
<Grid ColumnDefinitions="Auto" RowDefinitions="Auto,Auto"> <Grid ColumnDefinitions="Auto" RowDefinitions="Auto,Auto">
<Grid.Styles> <Grid.Styles>
<Styles> <Styles>
@ -17,7 +17,7 @@
</Style> </Style>
</Styles> </Styles>
</Grid.Styles> </Grid.Styles>
<Border Name="clipped" <Border Name="clipped"
Background="Yellow" Background="Yellow"
Width="100" Width="100"
Height="100" Height="100"
@ -44,9 +44,9 @@
<Border Name="clipChild" Background="{DynamicResource ThemeAccentBrush}" Margin="4"> <Border Name="clipChild" Background="{DynamicResource ThemeAccentBrush}" Margin="4">
<!-- Setting opacity puts the TextBox on a new layer --> <!-- Setting opacity puts the TextBox on a new layer -->
<TextBox Text="Avalonia" Opacity="0.9" VerticalAlignment="Center"/> <TextBox Text="Avalonia" Opacity="0.9" VerticalAlignment="Center"/>
<Border.RenderTransform> <Border.RenderTransform>
<RotateTransform/> <RotateTransform/>
</Border.RenderTransform> </Border.RenderTransform>
</Border> </Border>
</Border> </Border>
<CheckBox Name="useMask" IsChecked="True" Grid.Row="1">Apply Geometry Clip</CheckBox> <CheckBox Name="useMask" IsChecked="True" Grid.Row="1">Apply Geometry Clip</CheckBox>

4
samples/RenderDemo/Pages/DrawingPage.xaml

@ -98,7 +98,7 @@
</Border> </Border>
<!-- For comparison --> <!-- For comparison -->
<Ellipse Grid.Row="2" <Ellipse Grid.Row="2"
Grid.Column="0" Grid.Column="0"
Width="100" Width="100"
@ -127,6 +127,6 @@
Stretch="UniformToFill" Stretch="UniformToFill"
Fill="Blue" Fill="Blue"
Margin="5" /> Margin="5" />
</Grid> </Grid>
</UserControl> </UserControl>
Loading…
Cancel
Save