Skip to main content
 首页 » 编程设计

c#之为整个 Windows Phone 应用程序设置前景

2024年02月20日17unruledboy

如何更改应用程序中所有控件的前景色?我需要更改颜色:文本框、文本 block 、按钮边框。

一个一个做(超过100个控件)太费时间了。

请您参考如下方法:

这就是样式的用途。您可以在 app.xaml 文件中添加样式。像这样的东西:

<Application.Resources> 
    <Style TargetType="TextBlock"> 
        <Setter Property="Foreground" Value="White" /> 
    </Style> 
    <Style TargetType="TextBox"> 
        <Setter Property="Foreground" Value="White" /> 
    </Style> 
</Application.Resources>