Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/314.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 为什么单选按钮不会出现在Windows 8的弹出窗口中?_C#_Wpf_Xaml_Radio Button - Fatal编程技术网

C# 为什么单选按钮不会出现在Windows 8的弹出窗口中?

C# 为什么单选按钮不会出现在Windows 8的弹出窗口中?,c#,wpf,xaml,radio-button,C#,Wpf,Xaml,Radio Button,我使用VS2010在Windows7上开发了一个WPF/C#/.NET4.0应用程序。该应用程序运行良好,在XP和Windows7上运行良好。但是,在具有最新更新的Windows 8上,除了默认选择的单选按钮外,尽管弹出窗口中有相应的空间,但单选按钮不会显示在弹出窗口中。如果将鼠标移到单选按钮应该位于的位置,则当鼠标移到该按钮上时,该按钮将显示为它应该显示的状态。当鼠标从其上方移开时,按钮显示为鼠标未在其上方时的应有状态,它本来应该显示为这种状态,但没有 在我有单选按钮的所有其他情况下,它们按其

我使用VS2010在Windows7上开发了一个WPF/C#/.NET4.0应用程序。该应用程序运行良好,在XP和Windows7上运行良好。但是,在具有最新更新的Windows 8上,除了默认选择的单选按钮外,尽管弹出窗口中有相应的空间,但单选按钮不会显示在弹出窗口中。如果将鼠标移到单选按钮应该位于的位置,则当鼠标移到该按钮上时,该按钮将显示为它应该显示的状态。当鼠标从其上方移开时,按钮显示为鼠标未在其上方时的应有状态,它本来应该显示为这种状态,但没有

在我有单选按钮的所有其他情况下,它们按其应有的方式工作,只是它们没有按应有的方式对齐。它们在XP和Windows 7中正确对齐

更正:我使用.NET3.5开发了它,最近改为.NET4.0平台。当在.NET 3.5平台上编译并在Windows 8上运行时,这些单选按钮将按其应有的方式显示。除了切换到.NET 4.0平台并编译,然后在Windows 8下运行外,不做任何更改,单选按钮不再按其应有的方式显示,而是在鼠标移动到单选按钮上时按其应有的方式显示

当弹出窗口首次显示时,如何使这些单选按钮以非鼠标悬停状态显示

这是弹出的XAML,所有其他控件在Windows 8中显示并正常工作,如复选框:

<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>

二维码是一种小型图形图像,可以通过智能手机和手机快速扫描
其他设备。
二维码将仅包含您在快捷菜单中输入的紧急信息
辅助文件夹。
打印二维码并将其粘贴到LR USB卡背面(或其他位置)。
在紧急情况下,它可以被扫描,您的重要信息可以立即获得
(无需启动LR)

这是一个很容易解决的问题。以下是上述问题中已修改的XAML部分:

<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>

所需的只是从上述XAML中删除以下行:

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


设计RadioButton样式的XAML来自此处的另一篇文章,但其值已更改为我需要的值。我保留了BorderBrush值的原样。

你能以一些XAML的形式提供一个示例吗?我已经编辑了最初的帖子,它现在包含弹出窗口的XAML。您看到的XAML中:[]:的位置将以编程方式替换为适当的文本。请记住,在从XP到Windows8.X的所有操作系统中,这一切都可以正常工作。在Windows 8.X中,只有单选按钮才能正确显示,除非您将鼠标移到它们上。谢谢你调查此事。