ElementMenu 的 ActivationHost

发布于 2024-08-12 05:48:50 字数 1234 浏览 2 评论 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>

我应该在 emBallMenuActivationHost 中设置什么,以便手指点击时激活菜单在父 ScatterView.ItemTemplate 上?

I am creating dynamically ScatterView items using a 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 so that menu gets activated on a finger tap on the parent ScatterView.ItemTemplate?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

此刻的回忆 2024-08-19 05:48:50

正确的答案是:

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

我在 此处

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文