我已经创建了一个WPF应用程序。这必须有一个红色的主题。所以我将每种颜色设置为一种红色,但问题是窗口打开时窗口内的所有按钮都开始闪烁。有趣的是他们同时开始,但过了一段时间他们开始分歧。当表单失去焦点时,它们都会停止闪烁。单击一个按钮时,只有一个按钮保持闪烁。但当一个"不是按钮"控制获得焦点他们都开始再次闪烁。
我发现它可能需要对Focusable属性执行某些操作,但更改它并不会改变任何内容。我还找到了一种覆盖默认样式的方法,但这并没有解决以太问题。 Source
这是我的XAML代码:
<Grid x:Name="gServerSettings">
<Label x:Name="lTitle" Content="Server Settings" HorizontalAlignment="Center" Margin="182,0,0,166" VerticalAlignment="Center" Width="118" Foreground="#FFFF9999" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontSize="16" FontWeight="Bold" Height="34"/>
<TextBox x:Name="tServer" Margin="72,39,10,0" TextWrapping="Wrap" Background="{x:Null}" Foreground="#FFFF9999" BorderBrush="#FFFF9999" SelectionBrush="#FFFF9999" BorderThickness="1" VerticalContentAlignment="Center" Height="24" VerticalAlignment="Top" TabIndex="0"/>
<Label x:Name="lServer" Content="Server" HorizontalAlignment="Left" Margin="10,39,0,0" VerticalAlignment="Top" Width="62" Foreground="#FFFF9999" Height="24" VerticalContentAlignment="Center"/>
<TextBox x:Name="tDatabase" Margin="72,68,10,0" TextWrapping="Wrap" Background="{x:Null}" Foreground="#FFFF9999" BorderBrush="#FFFF9999" SelectionBrush="#FFFF9999" BorderThickness="1" VerticalContentAlignment="Center" Height="24" VerticalAlignment="Top" TabIndex="1"/>
<Label x:Name="lDatabase" Content="Database" HorizontalAlignment="Left" Margin="10,68,0,0" VerticalAlignment="Top" Width="62" Foreground="#FFFF9999" VerticalContentAlignment="Center" Height="24"/>
<TextBox x:Name="tUsername" Margin="72,97,10,0" TextWrapping="Wrap" Background="{x:Null}" Foreground="#FFFF9999" BorderBrush="#FFFF9999" SelectionBrush="#FFFF9999" BorderThickness="1" VerticalContentAlignment="Center" Height="24" VerticalAlignment="Top" TabIndex="2"/>
<Label x:Name="lUsername" Content="Username" HorizontalAlignment="Left" Margin="10,97,0,0" VerticalAlignment="Top" Width="62" Foreground="#FFFF9999" VerticalContentAlignment="Center" Height="24"/>
<Label x:Name="lPassword" Content="Password" HorizontalAlignment="Left" Margin="10,126,0,0" VerticalAlignment="Top" Width="62" Foreground="#FFFF9999" VerticalContentAlignment="Center" Height="24"/>
<PasswordBox x:Name="tPassword" Margin="72,126,10,0" Background="{x:Null}" Foreground="#FFFF9999" BorderBrush="#FFFF9999" SelectionBrush="#FFFF9999" BorderThickness="1" VerticalContentAlignment="Center" Height="24" VerticalAlignment="Top" TabIndex="3"/>
<Button x:Name="bOK" Content="OK" HorizontalAlignment="Left" Margin="215,168,0,0" VerticalAlignment="Top" Width="75" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="#FFFF9999" BorderThickness="1" IsDefault="True" TabIndex="6"/>
<Button x:Name="bCancel" Content="Cancel" HorizontalAlignment="Left" Margin="135,168,0,0" VerticalAlignment="Top" Width="75" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="#FFFF9999" BorderThickness="1" IsDefault="True" TabIndex="5"/>
<Button x:Name="bTestConnection" Content="Test Connection" HorizontalAlignment="Left" Margin="10,168,0,0" VerticalAlignment="Top" Width="120" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="#FFFF9999" BorderThickness="1" IsDefault="True" TabIndex="4" IsHitTestVisible="False"/>
</Grid>
我还没有以编程方式执行任何操作,因此我的.CS文件为空。
有人知道如何解决这个问题吗?
答案 0 :(得分:0)
你必须基本上重新实现按钮样式并删除该故事板。您可以使用Expression Blend转储默认按钮样式,并根据自己的喜好进行修改。没有任何其他简单的方法可以禁用该故事板。