views:

350

answers:

1

We have a window that displays fine on all of our Windows 7 development machines with Visual Studio but not on the ones without Visual Studio installed. We have a simple OK/Cancel button pair and on the affected machines the OK button is invisible but if you click in the place where it should be it still works.

Here are the styles used:

<Style x:Key="OptionsOkButton" TargetType="{x:Type Button}">
    <Setter Property="HorizontalAlignment" Value="Right" />
    <Setter Property="Width" Value="100" />
    <Setter Property="Height" Value="30" />
    <Setter Property="FontSize" Value="14" />
    <Setter Property="Margin" Value="5" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="Effect">
        <Setter.Value>
            <DropShadowEffect ShadowDepth="3" Opacity="0.7" />
        </Setter.Value>
    </Setter>
</Style>

<Style x:Key="OptionsCancelButton" TargetType="{x:Type Button}">
    <Setter Property="HorizontalAlignment" Value="Left" />
    <Setter Property="Width" Value="100" />
    <Setter Property="Height" Value="30" />
    <Setter Property="FontSize" Value="14" />
    <Setter Property="Margin" Value="5" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="Effect">
        <Setter.Value>
            <DropShadowEffect ShadowDepth="3" Opacity="0.7" />
        </Setter.Value>
    </Setter>
</Style>

And here is the code for the buttons:

<Grid Name="grdFooter" DockPanel.Dock="Bottom">
    <Grid.ColumnDefinitions>
        <ColumnDefinition/>
        <ColumnDefinition/>
    </Grid.ColumnDefinitions>
    <Button Grid.Column="0" Content="OK" Style="{StaticResource OptionsOkButton}" Click="btnOK_click"/>
    <Button Grid.Column="1" Content="Cancel" Style="{StaticResource OptionsCancelButton}" Click="btnCancel_Click"  />
</Grid>

It seems to be happening on every button pair that's using these styles (around 5 different windows). Does anyone have any ideas or suggestions on what might be causing it?

Edit: I should make it clear that everything works just fine even on fresh installs of Windows XP and Vista. It appears to be limited to Windows 7 and appears both on fresh installs and upgrades from Vista (works fine on Vista, upgrade, button disappears).

Edit 2: I should also make clear that only the OK button turns invisible, the Cancel button will still appear normally.

+2  A: 

According to this MSDN entry, DropShadowEffect is only supported in .NET 3.5 SP1. I'd guess this is installed on your Visual Studio machines, and that the others have an older version of the framework.

Ben M
We install 3.5sp1 as part of our installation process if it's not already there.
Bryan Anderson
Okay: So if you remove `DropShadowEffect`, do the buttons show up?
Ben M
Since both Ok and Cancel buttons had the same DropShadowEffect we assumed that wasn't it. I'll go check that now.
Bryan Anderson
That does appear to be it. Now I'm curious to see if DropShadowChrome has the same problem.
Bryan Anderson
That is odd. Does the cancel button have a drop shadow even when the OK button disappears? That would suggest something else entirely...
Ben M
Yes, the Cancel button still has a drop shadow even when the OK button is invisible.
Bryan Anderson
DropShadowChrome works just fine though.
Bryan Anderson
Sounds like some other issue. Are the video cards or drivers (coincidentally) different on the various Win7 machines?
Ben M