PageRenderTime 52ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/Visual Studio 2008/CSWPFAnimationWhenDataChanged/MainWindow.xaml

#
XAML | 76 lines | 73 code | 2 blank | 1 comment | 0 complexity | a33057b866a9528e48c6993c1159aa20 MD5 | raw file
  1. <Window x:Class="CSWPFAnimationWhenDataChanged.MainWindow"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:local="clr-namespace:CSWPFAnimationWhenDataChanged"
  5. Title="MainWindow" Height="473" Width="632" xmlns:my="http://schemas.microsoft.com/wpf/2008/toolkit">
  6. <Window.Resources>
  7. <Style x:Key="cellStyle" TargetType="{x:Type my:DataGridCell}">
  8. <Style.Triggers>
  9. <!--When Binding target is updated, trigger the animation-->
  10. <EventTrigger RoutedEvent="Binding.TargetUpdated">
  11. <BeginStoryboard>
  12. <Storyboard>
  13. <ColorAnimation Storyboard.TargetProperty="(Background).(SolidColorBrush.Color)" AutoReverse="True"
  14. To="Red" Duration="0:0:2"/>
  15. <ColorAnimation Storyboard.TargetProperty="(Background).(SolidColorBrush.Color)" AutoReverse="True"
  16. To="Transparent" BeginTime="0:0:2" Duration="0:0:2"></ColorAnimation>
  17. </Storyboard>
  18. </BeginStoryboard>
  19. </EventTrigger>
  20. </Style.Triggers>
  21. </Style>
  22. </Window.Resources>
  23. <Grid>
  24. <my:DataGrid ItemsSource="{Binding .}"
  25. Margin="10,10,12,188"
  26. Name="dataGrid1"
  27. AutoGenerateColumns="True"
  28. IsSynchronizedWithCurrentItem="True">
  29. </my:DataGrid>
  30. <Border Height="112"
  31. Margin="12,0,12,49"
  32. Name="border1"
  33. VerticalAlignment="Bottom"
  34. BorderBrush="Chocolate"
  35. BorderThickness="1.0">
  36. <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="103" Width="586">
  37. <Label Height="28"
  38. HorizontalAlignment="Left"
  39. HorizontalContentAlignment="Right"
  40. Margin="10,10,0,0"
  41. Name="label1"
  42. VerticalAlignment="Top"
  43. Width="82">Name:</Label>
  44. <Label HorizontalAlignment="Left"
  45. HorizontalContentAlignment="Right"
  46. Margin="10,44,0,26"
  47. Name="label2"
  48. Width="80">Job:</Label>
  49. <TextBox Height="23"
  50. Margin="107,15,7,0"
  51. Name="textBox1"
  52. VerticalAlignment="Top"
  53. Text="{Binding FirstName,
  54. Mode = TwoWay,
  55. UpdateSourceTrigger = PropertyChanged,
  56. NotifyOnSourceUpdated=True}"/>
  57. <TextBox Margin="107,44,7,31"
  58. Name="textBox2"
  59. Text="{Binding LastName, Mode = TwoWay,
  60. UpdateSourceTrigger = PropertyChanged,
  61. NotifyOnSourceUpdated=True}" />
  62. </Grid>
  63. </Border>
  64. <Label Height="25"
  65. Margin="10,0,91,163"
  66. Name="label3"
  67. VerticalAlignment="Bottom">Click the button in the bottom, and then edit in the following TextBoxes:</Label>
  68. <Button Height="23"
  69. Margin="12,0,12,12"
  70. Name="btnHookupAnimation"
  71. VerticalAlignment="Bottom"
  72. Click="btnHookupAnimation_Click">Hook up Animation</Button>
  73. </Grid>
  74. </Window>