ElectricSteve
ElectricSteve
CC#
Created by ElectricSteve on 4/21/2024 in #help
Disabled button Background & Foreground color
Hi, so I'm new to wpf and am trying to make my own app for private use.
<Grid DockPanel.Dock="Top" Height="30px" Tag="topbar" Background="#454545">
<Grid.Resources>
<Style TargetType="Button">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="#6E6E6E"/>
</Trigger>
</Style.Triggers>
</Style>
</Grid.Resources>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30px" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="30px" />
<ColumnDefinition Width="30px" />
<ColumnDefinition Width="30px" />
</Grid.ColumnDefinitions>
<Button Grid.Column="0" Click="TabButtonsOnClick" Tag="home"><Image Source="{StaticResource IconHome}"/></Button>

<Button Grid.Column="4" Click="ButtonBase_OnClick" Tag="close"><Image Source="{StaticResource IconClose}"/></Button>
<Button Grid.Column="3" Click="ButtonBase_OnClick" Tag="restore" IsEnabled="False"><Image Source="{StaticResource IconRestore}"/></Button>
<Button Grid.Column="2" Click="ButtonBase_OnClick" Tag="minimize" ><Image Source="{StaticResource IconMinimize}"/></Button>
</Grid>
<Grid DockPanel.Dock="Top" Height="30px" Tag="topbar" Background="#454545">
<Grid.Resources>
<Style TargetType="Button">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="#6E6E6E"/>
</Trigger>
</Style.Triggers>
</Style>
</Grid.Resources>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30px" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="30px" />
<ColumnDefinition Width="30px" />
<ColumnDefinition Width="30px" />
</Grid.ColumnDefinitions>
<Button Grid.Column="0" Click="TabButtonsOnClick" Tag="home"><Image Source="{StaticResource IconHome}"/></Button>

<Button Grid.Column="4" Click="ButtonBase_OnClick" Tag="close"><Image Source="{StaticResource IconClose}"/></Button>
<Button Grid.Column="3" Click="ButtonBase_OnClick" Tag="restore" IsEnabled="False"><Image Source="{StaticResource IconRestore}"/></Button>
<Button Grid.Column="2" Click="ButtonBase_OnClick" Tag="minimize" ><Image Source="{StaticResource IconMinimize}"/></Button>
</Grid>
And am trying to get the disabled button to have a specific style, but it isn't working, I also couldn't find anything online. Also literaly setting the style like this:
<Button Grid.Column="3" Click="ButtonBase_OnClick" Tag="restore" IsEnabled="False" Background="Transparent" Foreground="#6E6E6E">
<Button Grid.Column="3" Click="ButtonBase_OnClick" Tag="restore" IsEnabled="False" Background="Transparent" Foreground="#6E6E6E">
Also doesn't work. Can anyone help?
2 replies