Question

I've developed a WPF/C#/.NET 4.0 application on Windows 7 using VS2010. The application works great and runs fine on XP and Windows 7. However, on Windows 8 with latest updates, radio buttons, other than the default selected ones, do not appear on a popup though space for it is there. If you move the mouse over where the radio button is supposed to be, the button appears as it should when the mouse is over it. When the mouse is then removed from being over it, the button appears as it should when the mouse isn't over it, the way it should have appeared to begin with, but didn't.

In all other situations where I have radio buttons, they work as they should, other than they are not aligned like they should be. They are correctly aligned in XP and Windows 7.

Correction: I developed it using .NET 3.5, and recently changed to the .NET 4.0 platform. When compiled on the .NET 3.5 platform and run on Windows 8, those radio buttons appear as they should. Without changing anything other than switching to the .NET 4.0 platform and compiling, then running under Windows 8, the radio buttons no longer appear as they should, but appear as they should once the mouse is moved over them.

How do I get those radio buttons to appear in the non-mouse over state when the popup is first shown?

Here is the popup XAML, all other controls show and work fine in Windows 8, such as the CheckBoxes:

<Popup Name="MainPrintMenu"
        PlacementTarget="{Binding ElementName=btnPrint}"
        Placement="Bottom"
        HorizontalOffset="-99"
        VerticalOffset="-5"
        AllowsTransparency="True"
        StaysOpen="False">
    <Border BorderThickness="2"
            Background="White"
            CornerRadius="5"
            BorderBrush="Black">
        <Grid Background="Transparent">
            <StackPanel Name="PrintButtons"
                        Orientation="Vertical"
                        Background="Transparent"
                        Margin="5"
                        >
                <StackPanel.Resources>
                    <Style TargetType="Button">
                        <Setter Property="FontSize" Value="12" />
                        <Setter Property="FontWeight" Value="Bold" />
                        <Setter Property="HorizontalContentAlignment" Value="Center" />
                        <Setter Property="BorderBrush" Value="{x:Null}" />
                    </Style>
                    <Style TargetType="RadioButton">
                        <Setter Property="FontSize" Value="10" />
                        <Setter Property="FontWeight" Value="Bold" />
                        <Setter Property="HorizontalContentAlignment" Value="Left" />
                        <Setter Property="BorderBrush" Value="{x:Null}" />
                        <Style.Triggers>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter Property="Opacity" Value="0.50" />
                            </Trigger>
                        </Style.Triggers>
                    </Style>
                    <Style TargetType="CheckBox">
                        <Setter Property="FontSize" Value="10" />
                        <Setter Property="HorizontalContentAlignment" Value="Left" />
                        <Setter Property="Margin" Value="18,0,0,10" />
                        <Setter Property="BorderBrush" Value="{x:Null}" />
                        <Style.Triggers>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter Property="Opacity" Value="0.50" />
                            </Trigger>
                        </Style.Triggers>
                    </Style>
                </StackPanel.Resources>

                <RadioButton Name="MainPrintMenu_PQAI" GroupName="PM" Content="Print My 911 Info" IsChecked="True" />
                <StackPanel Orientation="Vertical" IsEnabled="{Binding ElementName=MainPrintMenu_PQAI, Path=IsChecked}" Margin="18,0,0,0">
                    <RadioButton Name="MainPrintMenu_PQAIR" GroupName="PM_PQAI" Content="Report" IsChecked="True" />
                    <CheckBox Name="PQAI_Blank" Content="Print blank entries too" IsEnabled="{Binding ElementName=MainPrintMenu_PQAIR, Path=IsChecked}" Margin="18,0,0,0" />
                    <RadioButton Name="MainPrintMenu_PQAIW" GroupName="PM_PQAI" Content="Wallet Card" Margin="0,0,0,10" />
                </StackPanel>

                <StackPanel Name="PrintIfLoggedIn" Orientation="Vertical">
                    <RadioButton Name="MainPrintMenu_PAF" GroupName="PM" Content="Print All Folders"/>
                    <CheckBox Name="PAF_Blank" Content="Print blank entries too" IsEnabled="{Binding ElementName=MainPrintMenu_PAF, Path=IsChecked}" />
                    <RadioButton Name="MainPrintMenu_PCF" GroupName="PM" Content="Print Current Folder: Folder" />
                    <CheckBox Name="PCF_Blank" Content="Print blank entries too" IsEnabled="{Binding ElementName=MainPrintMenu_PCF, Path=IsChecked}" />
                    <RadioButton Name="MainPrintMenu_PCSF" GroupName="PM" Content="Print Current Sub-Folder: :[Sub-FolderName]:" />
                    <CheckBox Name="PCSF_Blank" Content="Print blank entries too" IsEnabled="{Binding ElementName=MainPrintMenu_PCSF, Path=IsChecked}" />
                    <RadioButton Name="MainPrintMenu_PCForm" GroupName="PM" Content="Print Current Form: :[From]:" />
                    <CheckBox Name="PCForm_Blank" Content="Print blank entries too" IsEnabled="{Binding ElementName=MainPrintMenu_PCForm, Path=IsChecked}" />
                    <RadioButton Name="MainPrintMenu_PQRC" GroupName="PM" Content="Print QR Code" />
                    <StackPanel Margin="18,0,0,0"  Orientation="Horizontal" >
                        <Image Source="/LR;Component/Image/LR_QR.jpg" Width="30" Height="30" Margin="0,2,5,0" VerticalAlignment="Top" />
                        <TextBlock Width="250" Height="86" FontSize="8" TextWrapping="Wrap" IsEnabled="{Binding ElementName=MainPrintMenu_PQRC, Path=IsChecked}" >
                            A QR code is a small graphic image that can be quickly scanned by smartphone and
                            other devices.<LineBreak/><LineBreak/>
                            The QR code will contain only the emergency information you entered into the Quick
                            Assist folder.<LineBreak/><LineBreak/>
                            Print the QR code and affix it to the back of your LR USB card (or elsewhere).
                            In an emergency it can be scanned and your important information available immediately
                            (no need to start LR)
                        </TextBlock>
                    </StackPanel>
                </StackPanel>

                <StackPanel Orientation="Horizontal" Margin="0,5,0,0">
                    <Button Content="Print" Width="233" Click="Event_MainPrintMenu_Print_Click" IsEnabled="{Binding BindingGroupName=MPM, Path=Selected}"/>
                    <Button Content="Cancel" Width="70" Click="Event_MainPrintMenu_Cancel_Click" />
                </StackPanel>

            </StackPanel>
        </Grid>
    </Border>
</Popup>
Was it helpful?

Solution

It turned out to be an easy fix. Here is the XAML section from the above question that was altered:

<Style TargetType="RadioButton">
    <Setter Property="FontSize" Value="10" />
    <Setter Property="FontWeight" Value="Bold" />
    <Setter Property="HorizontalContentAlignment" Value="Left" />
    <Setter Property="BorderBrush" Value="{x:Null}" />
    <Style.Triggers>
        <Trigger Property="IsEnabled" Value="False">
            <Setter Property="Opacity" Value="0.50" />
        </Trigger>
    </Style.Triggers>
</Style>

All that was needed was the removal of the following line from the above XAML:

<Setter Property="BorderBrush" Value="{x:Null}" />

The XAML to style the RadioButton came from another post on here, but Values where changed to what I needed. I had left the BorderBrush value as it was.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top