小编meh*_*hdi的帖子

是否有任何方式可以在wpf中按名称进行特定控制

通过资源设置控件颜色.

在资源文件中:

<style TargetType="{x:Name button1}">
      <setter Property="ColorBrush" Value="Red"/>
</style>
<Window .... >
    <Button Name="Button1" Content="Test Button" />
</Window>
Run Code Online (Sandbox Code Playgroud)

喜欢html中的css

 <style>
       #controlID
       {
         color:red;
       }
    </style>
<body>
      <input id="button1" type="button" value="test button" />
</body>
Run Code Online (Sandbox Code Playgroud)

wpf styles

5
推荐指数
1
解决办法
5483
查看次数

标签 统计

styles ×1

wpf ×1