C# 主题转换不需要';t影响Windows Phone 8.1上禁用的控件主题

C# 主题转换不需要';t影响Windows Phone 8.1上禁用的控件主题,c#,windows-runtime,windows-phone-8.1,C#,Windows Runtime,Windows Phone 8.1,我想,这是一个错误 若要复制,请在Windows Phone上以黑色主题启动应用程序。 启动应用程序后,将主题更改为light。 然后点击“启用”按钮。 您将看到“示例”按钮消失。因为它的主题仍然是黑暗的 <Page x:Class="ButtonThemeTest.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.m

我想,这是一个错误

若要复制,请在Windows Phone上以黑色主题启动应用程序。 启动应用程序后,将主题更改为light。 然后点击“启用”按钮。 您将看到“示例”按钮消失。因为它的主题仍然是黑暗的

<Page x:Class="ButtonThemeTest.MainPage"
      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"
      Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
      mc:Ignorable="d">

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Button x:Name="ButtonTest"
                Content="Sample"
                IsEnabled="False" />
        <Button Grid.Row="1"
                Click="ButtonBase_OnClick"
                Content="Enable" />
        <Button Grid.Row="2"
                Click="ButtonBase_OnClick2"
                Content="Disable" />
    </Grid>
</Page>

使用Visual studio混合设置按钮样式。

我找到的唯一解决方案是从generic.xaml获取按钮样式,并向正常视觉状态添加情节提要,如下所示:

<Storyboard>
    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter"
                                   Storyboard.TargetProperty="Foreground">
        <DiscreteObjectKeyFrame KeyTime="0"
                                Value="{ThemeResource PhoneForegroundBrush}" />
    </ObjectAnimationUsingKeyFrames>
    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Border"
                                   Storyboard.TargetProperty="BorderBrush">
        <DiscreteObjectKeyFrame KeyTime="0"
                                Value="{ThemeResource PhoneForegroundBrush}" />
    </ObjectAnimationUsingKeyFrames>
    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Border"
                                   Storyboard.TargetProperty="Background">
        <DiscreteObjectKeyFrame KeyTime="0"
                                Value="{ThemeResource PhoneBackgroundBrush}" />
    </ObjectAnimationUsingKeyFrames>
</Storyboard>


是否检查了按钮的控制模板以查看其设计是否不正确?按钮的控制模板为默认值我已尝试将按钮的RequestedTemplate更改为Light。但是它也帮不上忙。即使是
按钮
也有一个控制模板。它是否有一个不正确的视觉状态定义为Enabled?我同意,这看起来像是一个决定,但在这种情况下,将模板设置为按钮是不可取的设计。
<Storyboard>
    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter"
                                   Storyboard.TargetProperty="Foreground">
        <DiscreteObjectKeyFrame KeyTime="0"
                                Value="{ThemeResource PhoneForegroundBrush}" />
    </ObjectAnimationUsingKeyFrames>
    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Border"
                                   Storyboard.TargetProperty="BorderBrush">
        <DiscreteObjectKeyFrame KeyTime="0"
                                Value="{ThemeResource PhoneForegroundBrush}" />
    </ObjectAnimationUsingKeyFrames>
    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Border"
                                   Storyboard.TargetProperty="Background">
        <DiscreteObjectKeyFrame KeyTime="0"
                                Value="{ThemeResource PhoneBackgroundBrush}" />
    </ObjectAnimationUsingKeyFrames>
</Storyboard>