PageRenderTime 9ms CodeModel.GetById 2ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 1ms

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