我有一个组件屏幕,它有两种状态:显示和隐藏。当我单击某个按钮时,组件会移动到舞台上。现在,当您单击组件时,我希望它移出舞台。对于普通元素,这通过使用激活状态来工作,但对于组件屏幕,它似乎没有做任何事情。
有人知道如何解决这个问题吗?
XML:
我屏幕内的组件:
<local:googlemaps x:Name="googlemaps" Margin="97,0,97,-509" d:IsPrototypingComposition="True" Cursor="Hand" VerticalAlignment="Bottom" d:LayoutOverrides="Height" RenderTransformOrigin="0.5,0.5">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseLeftButtonDown">
<pi:ActivateStateAction TargetState="hide"/>
</i:EventTrigger>
</i:Interaction.Triggers>
<local:googlemaps.RenderTransform>
<CompositeTransform/>
</local:googlemaps.RenderTransform>
</local:googlemaps>
组件画面:
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pc="http://schemas.microsoft.com/prototyping/2010/controls"
mc:Ignorable="d"
x:Class="EurekaScreens.googlemaps"
d:DesignWidth="606" d:DesignHeight="480" Height="480" Width="606">
<Grid x:Name="LayoutRoot">
<Rectangle Fill="#FF212121" Margin="10,8,0,0" Stroke="Black"/>
<Rectangle Fill="#FF212121" Margin="0,0,4,3" Stroke="Black" HorizontalAlignment="Right" Width="602"/>
<Image Margin="1,1,5,4" Source="google maps.jpg" Stretch="Fill"/>
<pc:SketchRectangleSL HorizontalAlignment="Right" Height="30" Margin="0,0,15,11" Style="{StaticResource Rectangle-Sketch}" VerticalAlignment="Bottom" Width="87"/>
<TextBlock HorizontalAlignment="Right" Margin="0,0,36,13" Style="{StaticResource SubtitleLeft-Sketch}" TextWrapping="Wrap" Text="CLOSE" VerticalAlignment="Bottom" FontSize="18.667" Height="23" Width="44"/>
</Grid>
</UserControl>