Windows 8 弹出位置 [英] windows 8 popup location

查看:23
本文介绍了Windows 8 弹出位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在将 WPF 应用程序移植到在 VMware 下运行的 Windows 8 实例 (x64) 时,我发现所有弹出窗口都未与它们应有的位置对齐.进一步的调查表明,即使对于新创建的项目,这也是一个常见的问题".WPF的弹窗控件好像改变了左右的意思!可以通过使用 vs 2012 创建 wpf 应用程序并在其中放置一些弹出窗口来显示问题,例如:

While porting a WPF application over to a Windows 8 instance (x64) runing under VMware, I found that all of the popups are mis-aligned against what they are supposed to be. Further investigations reveal that this is a common "problem" even for a newly created project. The popup control of WPF seems to have changed the meaning of left and right! The problem can be show by creating a wpf application using vs 2012 and put some popups in it, like:

<Grid Background="Gray">
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="129*"/>
        <ColumnDefinition Width="264*"/>
        <ColumnDefinition Width="124*"/>
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
        <RowDefinition Height="30"/>
        <RowDefinition Height="30"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>
    <DockPanel Grid.Row="1" Grid.Column="1" Background="LightGray">
        <Popup StaysOpen="True" IsOpen="True" Grid.RowSpan="2" Placement="Right"  AllowsTransparency="True" >
            <TextBlock Text="Right" Foreground="White" />
        </Popup>
        <Popup StaysOpen="True" IsOpen="True" Grid.RowSpan="2" Placement="Left" AllowsTransparency="True"  >
            <TextBlock Text="Left" Foreground="White" />
        </Popup>
        <Popup StaysOpen="True" IsOpen="True" Grid.RowSpan="2" Placement="Top"  AllowsTransparency="True" >
            <TextBlock Text="Top" Foreground="White" />
        </Popup>
        <Popup StaysOpen="True" IsOpen="True" Grid.RowSpan="2" Placement="Bottom"  AllowsTransparency="True"  >
            <TextBlock Text="Bottom" Foreground="White" />
        </Popup>
    </DockPanel>
</Grid>

本来应该显示在左边的弹出框实际上显示在右边,反之亦然,应该在左下角的弹出框显示在右下角,以此类推.

The popup that is supposed to be displayed on the left is actually displayed on the right and vice versa, the one that is supposed to be at the bottom left is displayed at bottom right, etc..

我的问题是:1) 这是错误还是功能?2) 如果它是一个功能,如何对代码进行最小的更改,以便它们在 Windows 7 和 Windows 8 中以相同的方式执行?

My question is: 1) is this a bug or feature? 2) if it is a feature, how to make minimun changes to the codes so that they perform in the same way inside Windows 7 and Windows 8?

推荐答案

进一步调查发现控制面板里面有一个设置:ControlPanel->Hardware and Sound->Tablet PC(节点名称可能不完全匹配,因为我使用的是非英文版本的 Windows 8).有一个用户喜欢使用的手写设置.

Further investigation shows that there is a setting inside the Control Panel: ControlPanel->Hardware and Sound->Tablet PC (the node name maybe not exactly match since I am using a non-English version of Windows 8). There is a setting for the hand using which the user prefers to write.

必须选择我更喜欢用左手书写",以便根据 .net 框架的手册将弹出窗口放置在正确的位置"(不使用上述解决方案).这种假设完全不正确,至少对于停止应用程序而言是这样!

One must select "I prefer writing using left hand" in order for it to place the popup in the "right position" (without using the solution above) according to the manual for .net framework. This assumption can't be right at all, at least for destop applications!

这篇关于Windows 8 弹出位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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