Hello. There is the following code, which works fine for me in a WPF application, but in a Silverlight application it swears that EventTrigger does not have the SourceName property.

The logic is as follows: when you click on a button, you hide the Grid and the button that you clicked on, we show another button; when you click on it, the opposite happens.

<Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid> <Grid.Triggers> <EventTrigger SourceName="HyperlinkButtonCollapsed" RoutedEvent="Button.Click"> <BeginStoryboard> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetName="CollapsedGrid" Storyboard.TargetProperty="Visibility"> <DiscreteObjectKeyFrame KeyTime="0:0:0"> <DiscreteObjectKeyFrame.Value> <Visibility>Hidden</Visibility> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HyperlinkButtonDetails" Storyboard.TargetProperty="Visibility"> <DiscreteObjectKeyFrame KeyTime="0:0:0"> <DiscreteObjectKeyFrame.Value> <Visibility>Visible</Visibility> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HyperlinkButtonCollapsed" Storyboard.TargetProperty="Visibility"> <DiscreteObjectKeyFrame KeyTime="0:0:0"> <DiscreteObjectKeyFrame.Value> <Visibility>Hidden</Visibility> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> </Storyboard> </BeginStoryboard> </EventTrigger> <EventTrigger SourceName="HyperlinkButtonDetails" RoutedEvent="Button.Click"> <BeginStoryboard> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetName="CollapsedGrid" Storyboard.TargetProperty="Visibility"> <DiscreteObjectKeyFrame KeyTime="0:0:0"> <DiscreteObjectKeyFrame.Value> <Visibility>Visible</Visibility> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HyperlinkButtonDetails" Storyboard.TargetProperty="Visibility"> <DiscreteObjectKeyFrame KeyTime="0:0:0"> <DiscreteObjectKeyFrame.Value> <Visibility>Hidden</Visibility> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HyperlinkButtonCollapsed" Storyboard.TargetProperty="Visibility"> <DiscreteObjectKeyFrame KeyTime="0:0:0"> <DiscreteObjectKeyFrame.Value> <Visibility>Visible</Visibility> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> </Storyboard> </BeginStoryboard> </EventTrigger> </Grid.Triggers> <Button Content="Свернуть" Height="23" HorizontalAlignment="Left" Margin="54,40,0,0" Name="HyperlinkButtonCollapsed" VerticalAlignment="Top" Width="75"/> <Button Visibility="Hidden" Content="Подробности" Height="23" HorizontalAlignment="Left" Margin="54,40,0,0" Name="HyperlinkButtonDetails" VerticalAlignment="Top" Width="75" /> <Grid x:Name="CollapsedGrid" Margin="40,97,69,37" Visibility="Visible"> <Border Grid.ColumnSpan='2' BorderThickness='1' BorderBrush='#FFD4D4D4' Padding='10,5'> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width='Auto'/> <ColumnDefinition Width='6'/> <ColumnDefinition Width='*'/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height='Auto'/> <RowDefinition Height='5'/> <RowDefinition Height='Auto'/> <RowDefinition Height='5'/> <RowDefinition Height='Auto'/> <RowDefinition Height='*'/> </Grid.RowDefinitions> <TextBlock Text='gfgfgfgfgfgfgf:'/> <StackPanel Orientation='Horizontal' Grid.Column='2'> <TextBlock Text='100000000000000000.00' Margin='0,0,6,0'/> <TextBlock Text='eur'/> </StackPanel> <TextBlock Text='tttttttttttttt:' Grid.Row='2'/> <StackPanel Orientation='Horizontal' Grid.Row='2' Grid.Column='2' > <TextBlock Text='0' Margin='0,0,6,0'/> <TextBlock Text='eur'/> </StackPanel> <TextBlock Text='rrrrrrrrrrrrrrrrr:' Grid.Row='4'/> <StackPanel Orientation='Horizontal' Grid.Row='4' Grid.Column='2' > <TextBlock Text='10000000' Margin='0,0,6,0'/> <TextBlock Text='eur'/> </StackPanel> </Grid> </Border> </Grid> </Grid> </Window> 

On MSDN it is written that in Silverlight it is possible to handle only the Loaded MSDN event. EventTrigger Silverlight

In Silverlight, it is a Loaded event.

In this regard, the question is, is it possible to implement the same thing on Silverlight, exclusively on XAML, and if so, how?

    0