tags:

views:

193

answers:

1

I am trying to change the Background Color of the ParentGrid when the child control ( Button ) ChildButton is clicked

I want to achive this using Triggers but not sure if this is even possible

Please Suggest a way to DO this through XAML only

<Grid Name="ParentGrid" Background="Red">
            <Button Name="ChildButton" />
</Grid>

Thanks

+1  A: 
<Grid Name="ParentGrid" Background="Red">
    <Button Name="ChildButton" Margin="100">
        <Button.Triggers>
            <EventTrigger RoutedEvent="ButtonBase.Click">
                <BeginStoryboard>
                    <Storyboard>
                        <ColorAnimation Duration="0" 
  Storyboard.TargetName="ParentGrid" 
  Storyboard.TargetProperty="Background.Color" To="Blue"/>
                    </Storyboard>
                </BeginStoryboard>
            </EventTrigger>
        </Button.Triggers>
    </Button>
</Grid>
Sergey Aldoukhov
Thx for the response
Amit