views:

144

answers:

1

I am creating dynamically ScatterView items using template:

<s:ScatterView.ItemTemplate >
            <DataTemplate>
                <DockPanel LastChildFill="True" >
                    <DockPanel.Background>
                        <ImageBrush ImageSource="{Binding Type, Converter={StaticResource imgSelector}}" Stretch="Fill" />
                    </DockPanel.Background>
                    <TextBox Background="Transparent" DockPanel.Dock="Top" Text="{Binding Path=Message}"
                             IsReadOnly="True" TextWrapping="Wrap" />
                    <s:ElementMenu Name="emBallMenu" VerticalAlignment="Top" ActivationMode="HostInteraction" ActivationHost="?????">
                        <s:ElementMenuItem Header="Send back" x:Name="emiSendBack" Command="local:MainSurfaceWindow.MenuItemCommand" CommandParameter="{Binding Path=BallId}"/>
                    </s:ElementMenu>
                </DockPanel>
            </DataTemplate>
        </s:ScatterView.ItemTemplate>

What should-I set in the ActivationHost of the emBallMenu that menu gets activated on a finger tap on the parent ScatterView.ItemTemplate?

A: 

The correct response is :

<s:ElementMenu Name="emBallMenu" 
    VerticalAlignment="Top" 
    ActivationMode="HostInteraction" 
    ActivationHost="{Binding RelativeSource=RelativeSource FindAncestor, 
                    AncestorType={x:Type s:ScatterViewItem}}}" 
/>

I found this in here

Radu Poe