为什么在某些计算机上,我的弹出窗口显示在Placement属性的对面? [英] Why is my Popup showing opposite the Placement property on some machines?

查看:100
本文介绍了为什么在某些计算机上,我的弹出窗口显示在Placement属性的对面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的WPF弹出窗口,当用户单击按钮"时会显示该窗口.

I have a simple WPF Popup that I am showing when the user clicks a Button.

<Button
    x:Name="aButton"
    Content="Up/Down"
    Width="75"
    Height="30"
    Click="aButton_Click"
/>
<Popup
    PlacementTarget="{Binding ElementName=aButton}"
    Placement="Right"
    VerticalOffset="-31"
    StaysOpen="False"
    AllowsTransparency="True"
>
    <StackPanel>
        <Button Width="45" Height="45" Margin="2,0,2,2" Content="+"/>
        <Button Width="45" Height="45" Margin="2,0,2,0" Content="-"/>
    </StackPanel>
</Popup>

极其奇怪的是...该代码的运行方式不同,具体取决于它在什么计算机上运行.

What is extremely weird ... is that this code works differently depending on what machine it runs on.

我在主桌面上运行此代码,并且一切正常……并且应该如此.我在PDC09上网本上运行它……弹出窗口显示为相反(在左边,而不是我在Placement属性中所告诉的右边).

I run this code on my main desktop and everything works just fine ... and as it should. I run it on my PDC09 netbook ... and the Popup shows opposite (on the left instead of the right as I told it to with the Placement property).

这是为什么?那我该怎么办?

Why is this? And what can I do about it?

推荐答案

我无法通过Google找到任何东西……但是在

I couldn't find anything via Google ... but a lucky search in the WPF forum, quickly found this post. Note to self: don't forget to search the WPF forums if Google can't find anything.

答案是,我的PDC09上网本本质上是一台Tablet PC,显然,Microsoft认为在为右撇子配置的Tablet PC上显示与Placement属性相反的Popup是一个好主意.这样,弹出窗口就不会出现在用户的手下.

The answer is that my PDC09 netbook is a Tablet PC at heart, and apparently, Microsoft thought it was a good idea to show the Popup opposite to the Placement property on a Tablet PC that is configured for right-handed people ... such that the Popup doesn't appear under the user's hand.

解决方案是还原到自定义弹出窗口的放置位置……如果您不希望出现这种情况,则为

The solution is to revert to custom Popup placement ... if you don't want this behavior.

我很想知道解决此问题的其他方法.

I would love to hear about any other ways around this problem.

这篇关于为什么在某些计算机上,我的弹出窗口显示在Placement属性的对面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆