C
C#2w ago
yatta

Metro MahApps checkbox content change color when hovered.

I have a checkbox that will change the color of the content inside. As the gif shows, you can see that, the content does change color, however, the color is also changed when I hover the mouse over it, I try to find a way to disable the hover functionality but it seems to be no use at all. If anyone knows anything or could give me some suggestions, i'd be very grateful
No description
1 Reply
yatta
yatta2w ago
This is the xaml code for the checkbox:
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
<CheckBox HorizontalAlignment="Center" VerticalAlignment="Center"
IsChecked="{Binding SupressionOnOthers}"
Content="!" FontSize="24" FontWeight="Bold"
controls:CheckBoxHelper.ForegroundChecked="{Binding SupressionColor, Converter={StaticResource ColorBrushConverter}}"
ToolTip="{Binding Supression, Source={x:Static client:Loc.I}}">
</CheckBox>
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
<CheckBox HorizontalAlignment="Center" VerticalAlignment="Center"
IsChecked="{Binding SupressionOnOthers}"
Content="!" FontSize="24" FontWeight="Bold"
controls:CheckBoxHelper.ForegroundChecked="{Binding SupressionColor, Converter={StaticResource ColorBrushConverter}}"
ToolTip="{Binding Supression, Source={x:Static client:Loc.I}}">
</CheckBox>
The property that control the checkbox content:
private bool mSupressionOnOthers;

public bool SupressionOnOthers
{
get { return mSupressionOnOthers; }
set
{
if (SetProperty(ref mSupressionOnOthers, value))
{
if (value)
SupressionColor = Color.Red;
else
SupressionColor = Color.Black;
}
}
}
private bool mSupressionOnOthers;

public bool SupressionOnOthers
{
get { return mSupressionOnOthers; }
set
{
if (SetProperty(ref mSupressionOnOthers, value))
{
if (value)
SupressionColor = Color.Red;
else
SupressionColor = Color.Black;
}
}
}
Want results from more Discord servers?
Add your server