Всем привет. Есть следующий код, который у меня отлично работает в приложении WPF, но в приложении Silverlight ругается на то, что у EventTrigger нет свойства SourceName.
Логика следующая: при нажатии на кнопке скрываем Grid и кнопку на которую нажали, показываем другую кнопку, при нажатии на неё происходит обратное действие.
<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>
На MSDN написано, что в Silverlight можно обрабатывать только событие Loaded MSDN EventTrigger Silverlight
In Silverlight, the only event that you can use for an EventTrigger is the Loaded event.
В связи с этим вопрос, возможно ли реализовать тоже самое на Silverlight, исключительно на XAML и если да, то как?