0

我正在ScatterView使用模板动态创建项目:

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

我应该在 的ActivationHost中设置什么,emBallMenu以便通过手指点击父菜单来激活菜单ScatterView.ItemTemplate

4

1 回答 1

1

正确的反应是:

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

我在这里找到了这个

于 2009-11-25T14:16:36.810 回答