/Visual Studio 2008/CSWPFAnimationWhenDataChanged/MainWindow.xaml
XAML | 76 lines | 73 code | 2 blank | 1 comment | 0 complexity | a33057b866a9528e48c6993c1159aa20 MD5 | raw file
- <Window x:Class="CSWPFAnimationWhenDataChanged.MainWindow"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:local="clr-namespace:CSWPFAnimationWhenDataChanged"
- Title="MainWindow" Height="473" Width="632" xmlns:my="http://schemas.microsoft.com/wpf/2008/toolkit">
- <Window.Resources>
-
- <Style x:Key="cellStyle" TargetType="{x:Type my:DataGridCell}">
- <Style.Triggers>
- <!--When Binding target is updated, trigger the animation-->
- <EventTrigger RoutedEvent="Binding.TargetUpdated">
- <BeginStoryboard>
- <Storyboard>
- <ColorAnimation Storyboard.TargetProperty="(Background).(SolidColorBrush.Color)" AutoReverse="True"
- To="Red" Duration="0:0:2"/>
- <ColorAnimation Storyboard.TargetProperty="(Background).(SolidColorBrush.Color)" AutoReverse="True"
- To="Transparent" BeginTime="0:0:2" Duration="0:0:2"></ColorAnimation>
- </Storyboard>
- </BeginStoryboard>
- </EventTrigger>
- </Style.Triggers>
- </Style>
- </Window.Resources>
- <Grid>
- <my:DataGrid ItemsSource="{Binding .}"
- Margin="10,10,12,188"
- Name="dataGrid1"
- AutoGenerateColumns="True"
- IsSynchronizedWithCurrentItem="True">
-
- </my:DataGrid>
- <Border Height="112"
- Margin="12,0,12,49"
- Name="border1"
- VerticalAlignment="Bottom"
- BorderBrush="Chocolate"
- BorderThickness="1.0">
- <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="103" Width="586">
- <Label Height="28"
- HorizontalAlignment="Left"
- HorizontalContentAlignment="Right"
- Margin="10,10,0,0"
- Name="label1"
- VerticalAlignment="Top"
- Width="82">Name:</Label>
- <Label HorizontalAlignment="Left"
- HorizontalContentAlignment="Right"
- Margin="10,44,0,26"
- Name="label2"
- Width="80">Job:</Label>
- <TextBox Height="23"
- Margin="107,15,7,0"
- Name="textBox1"
- VerticalAlignment="Top"
- Text="{Binding FirstName,
- Mode = TwoWay,
- UpdateSourceTrigger = PropertyChanged,
- NotifyOnSourceUpdated=True}"/>
- <TextBox Margin="107,44,7,31"
- Name="textBox2"
- Text="{Binding LastName, Mode = TwoWay,
- UpdateSourceTrigger = PropertyChanged,
- NotifyOnSourceUpdated=True}" />
- </Grid>
- </Border>
- <Label Height="25"
- Margin="10,0,91,163"
- Name="label3"
- VerticalAlignment="Bottom">Click the button in the bottom, and then edit in the following TextBoxes:</Label>
- <Button Height="23"
- Margin="12,0,12,12"
- Name="btnHookupAnimation"
- VerticalAlignment="Bottom"
- Click="btnHookupAnimation_Click">Hook up Animation</Button>
- </Grid>
- </Window>