.net - How do I set my trigger so that it fires when an event occurs on a different control? -


I am trying to execute the animation of an element when a certain button, which is present in the window, clicked goes.

Here's what I've tried:

   & Lt; / Storyboard & gt; & Lt; / BeginStoryboard & gt; & Lt; /EventTrigger.Actions> & Lt; / EventTrigger & gt; & Lt; /Border.Triggers> & Lt; ScrollViewer VerticalScrollBarVisibility = "Auto" & gt; & Lt; ItemsControl X: Name = "itmsSearch" ItemsSource = "{Binding}" padding = "4" ItemTemplate = "{StaticResource SearchResultItemDT}" & gt; & Lt; / ItemsControl> & Lt; / ScrollViewer & gt; & Lt; / Border & gt;   

The attribute for my EventTrigger seems to be wrong value which stops an exception stating that any element with the name btnSearch can be found to be thrown.

The said button stays elsewhere in my window:

  & lt; StackPanel height = "30" Orientation = "horizontal" margin = "5" & gt; & Lt; Text box x: name = "txt search" width = "650" fontfilmie = "comic sans ms" foreground = "chocolate" /> & Lt; Button x: name = "btn search" width = "100" content = "go!" Click = "BtnSearch_Click" /> & Lt; / StackPanel & gt;   

I think that setting the sourceName to the name of the required button will be a trick but it is not working: (

StoryBoard.TargetName Try setting the property element name you want to animate.You already have set StoryBoard.TargetProperty . When the targetname property is not set, then it is assumed to be the current element.

You set SOURCENAME Not required

Example:

  grid xmlns = "http: //schemas.microsoft.com/winfx/2006/xaml/presentation" & Gt; & lt; Grid.Triggers & gt; EventTrigger RoutedEvent = "Grid.Loaded">  < Lt; from the double animation = "0" from = "0" period = "0: 0: 4" autorvers = "true" repeats = "always" /> gt; & lt; / storyboard & gt; & lt; / BeginStoryboard & Gt; & Lt; / EventTrigger & gt; & Lt; / Grid. Triggers & gt; & Lt; Image name = "jim1" source = "jim1.gif" /> & Lt; Image name = "jim2" source = "jim2.gif" /> & Lt; / Grid & gt;    

Comments