我们有一个窗口,它在中心显示一条消息,背景为半透明,如下所示:
<Window x:Class="Dialogs.Touch.MessageWindow" Style="{DynamicResource DialogWindow}"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:i="clr-namespace:I.GUI.Controls.WPF"
Title="MessageWindow" WindowState="Maximized" AllowsTransparency="True" WindowStartupLocation="CenterScreen" PreviewKeyDown="Window_PreviewKeyDown">
<Window.Resources>
<ResourceDictionary x:Name="StyleDictionary">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Styles/TouchStyle.xaml"/>
<ResourceDictionary Source="../Styles/DialogsStyle.xaml"/>
<ResourceDictionary Source="../../Styles/GUIStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Window.Background>
<SolidColorBrush x:Name="WindowBrush" Color="#88000000"/>
</Window.Background>
<ContentControl>
<Border Margin="20" Width="460" MaxHeight="1000" VerticalAlignment="Center" HorizontalAlignment="Center" Style="{DynamicResource WindowBorder}" >
<Grid Margin="0" >
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="{Binding ElementName=MessageTextBlock, Path=Height, Mode= OneWay}" />
<RowDefinition Height="90" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Name="IconColumn">
<ColumnDefinition.Style>
<Style TargetType="{x:Type ColumnDefinition}">
<Setter Property="Width" Value="58"/>
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=IconImage, Path=Visibility}" Value="Collapsed" >
<Setter Property="Width" Value="0"/>
</DataTrigger>
</Style.Triggers>
</Style>
</ColumnDefinition.Style>
</ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Style="{DynamicResource WindowHeaderBorder}">
<DockPanel>
<i:TouchButton DockPanel.Dock="Right" TouchButtonStyle="Quit" Content="X" Width="35" x:Name="Button1" />
<TextBlock VerticalAlignment="Center" Style="{DynamicResource LargeTextBlock}" Foreground="{DynamicResource LightTextColour1}" Text="Title" Name="TitleTextBlock"></TextBlock>
</DockPanel>
</Border>
<Image Name="IconImage" Width="48" Height="48" Grid.Row="1" Margin="5" VerticalAlignment="Top" HorizontalAlignment="Left" RenderOptions.BitmapScalingMode="Fant" Source="/SI.GUI;component/Images/warning.ico"></Image>
<TextBlock Margin="10,5,5,5" Grid.Row="1" Grid.Column="2" Style="{DynamicResource MediumTextBlock}" Text="Message" Name="MessageTextBlock" TextWrapping="Wrap"></TextBlock>
<StackPanel Grid.ColumnSpan="2" Grid.Row="2" Orientation="Horizontal" VerticalAlignment="Bottom" FlowDirection="RightToLeft">
<i:TouchButton TouchButtonStyle="Negative" VerticalAlignment="Bottom" Content="Cancel" HorizontalAlignment="Right" Height="70" Width="150" x:Name="CancelButton"/>
<i:TouchButton TouchButtonStyle="Positive" VerticalAlignment="Bottom" Content="OK" HorizontalAlignment="Right" Height="70" Width="150" x:Name="OkButton"/>
</StackPanel>
</Grid>
</Border>
</ContentControl>
在我们的一台测试机器上,当鼠标放在窗口中心的消息控件上时,其中包含消息和按钮等(参见边框标签),鼠标光标变得非常不稳定。
它通常在窗口背景上移动。
这仅在系统处于多监视器模式时发生。当只使用一台显示器时,光标会正常移动。
系统正在运行 Windows XP。
谢谢