开发者

WPF window content randomly falls apart

WPF application, uses a Window dialog to enter PIN. Normally, it looks like this: https://picasaweb.google.com/lh/photo/Xl-X6Lxf9QMYSHimMY7gAA?feat=directlink

On a Windows XP kiosk, the window falls apart, randomly. There is no exact way of reproducing it, but clicking around wildly will bring it sooner or later. https://picasaweb.google.com/lh/photo/-jpkc8_CBKycdASWW4fbyQ?feat=directlink Not always exactly like pictured, but a similar way. Looks like the controls are not positioned properly.

The box is Wincor Nixdorf touchscreen kiosk, using WinXP SP3, Fx 3.5 SP1. The window markup is this:

<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
xmlns:loc="clr-namespace:Company.Product.Common.Localization;assembly=Company.Product.Common"
xmlns:locSecurity="clr-namespace:Company.Product.Common.Localization.Security;assembly=Company.Product.Common"
x:Class="Company.Product.Modules.Security.PassPhraseEntryDialog"
x:Name="Window"
Title="{x:Static locSecurity:PassPhraseEntryDialog.Window_Title}"
Width="224" Height="141" mc:Ignorable="d" 
WindowStartupLocation="CenterOwner"
WindowStyle="ToolWindow" 
ResizeMode="NoResize"
Loaded="Window_Loaded">

<Window.Resources>
    <ResourceDictionary>

        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="..\ResourceDictionaries\Styles.xaml"/>
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Window.Resources>

<Canvas x:Name="LayoutRoot">
    <Label Content="{x:Static locSecurity:PassPhraseEntryDialog.Password_Label}" Canvas.Left="8" Canvas.Top="8" Width="72" Height="27"/>
    <PasswordBox x:Name="passwordBox" Canvas.Left="77" Canvas.Top="8" Width="118" Height="27"/>
    <Button x:Name="okButton" Width="75" Content="{x:Stati开发者_运维百科c loc:Common.Ok}" Canvas.Left="8" Canvas.Top="73." Click="OkButton_Click"  IsDefault="True"/>
    <Button x:Name="cancelButton" Width="75" Content="{x:Static loc:Common.Cancel}" Canvas.Left="125" Canvas.Top="73" IsCancel="True" />
    <TextBlock x:Name="errorMessage" Width="192" Height="19" Canvas.Left="8" Canvas.Top="37" TextWrapping="Wrap" Foreground="Red">
        <TextBlock.Background>
            <SolidColorBrush/>
        </TextBlock.Background>
    </TextBlock>
    <TextBlock Text="{x:Static loc:Common.ChangePin}" Style="{Binding Source={StaticResource  LinkTextStyle}}" HorizontalAlignment="Right" Canvas.Top="41" Canvas.Left="8" Margin="0,10,10,5" Cursor="Hand" x:Name="txtChangePin" MouseLeftButtonUp="txtChangePin_MouseLeftButtonUp" />

</Canvas>

Any tips or ideas are very welcome.


I don't know exactly what the cause is, but I strongly suspect that this has something to do with the rendering hardware.

I would try changing the rendering settings for WPF applications on the target machine. See this link for the relevant registry settings.


Have you tried specifying a Height/Width for your canvas? I don't believe the Canvas automatically sizes to fill available space, and perhaps this is causing confusion when rendering on occasion

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜