0

表示と非表示の 2 つの状態を持つコンポーネント画面があります。ボタンをクリックすると、コンポーネントがステージに移動します。コンポーネントをクリックすると、ステージの外に戻ります。通常の要素では、これはアクティブ化状態を使用して機能しますが、コンポーネント画面では何もしないようです。

これを解決する方法を知っている人はいますか?

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>
4

1 に答える 1

0

コンポーネント画面の xaml と、それを含む画面を投稿していただけますか? コンポーネントのどこをクリックしても機能しますか? 背景がないため、クリックイベントを受信しない可能性があると考えています。クリアな背景を割り当ててみてください。

それ以外の場合は、xaml を投稿してください。私がお手伝いできるかどうかを確認します。

理由はよくわかりませんが、何らかの理由でマウス ダウン イベントが動作していないようです。コンポーネント画面をグリッドでラップし、動作をグリッドに配置すると、正しく動作するようです:

<Grid HorizontalAlignment="Right" Margin="0,-2,-625,2" Width="606" Background="#00000000">
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="MouseLeftButtonUp">
                    <pi:ActivateStateAction TargetState="hide"/>
                </i:EventTrigger>
            </i:Interaction.Triggers>
            <local:Screen_2 x:Name="screen_2" Height="480" Width="606" d:IsPrototypingComposition="True" RenderTransformOrigin="0.5,0.5">
                <local:Screen_2.RenderTransform>
                    <CompositeTransform/>
                </local:Screen_2.RenderTransform>
            </local:Screen_2>
        </Grid>
于 2010-09-21T12:41:51.807 に答える