✅ How to add hover effect to WPF button element
This code I'm using isn't working. When I hover over buttons its a lightblue color.
<Style TargetType="Button">
<Setter Property="FontSize" Value="18" />
<Setter Property="FontWeight" Value="Medium" />
<Setter Property="Foreground" Value="#262626" />
<Setter Property="Background" Value="#ECECEC" />
<Setter Property="BorderThickness" Value="0" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#E0E0E0" />
</Trigger>
</Style.Triggers>
</Style>
G
goooosee•401d ago
<ControlTemplate.Triggers>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Background" TargetName="border" Value="#dbd94d"/>
</Trigger>
<Trigger Property="IsMouseOver"
Value="True" />
<EventTrigger RoutedEvent="Border.MouseEnter"
SourceName="border">
<BeginStoryboard>
<Storyboard>
<ColorAnimation Storyboard.TargetName="BorderBackground"
Storyboard.TargetProperty="Color"
From="#202020"
To="#dbd94d"
Duration="0:0:0.2" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
<EventTrigger RoutedEvent="Border.MouseLeave"
SourceName="border">
<BeginStoryboard>
<Storyboard>
<ColorAnimation Storyboard.TargetName="BorderBackground"
Storyboard.TargetProperty="Color"
From="#dbd94d"
To="#212121"
Duration="0:0:0.2" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</ControlTemplate.Triggers>
just change IsPressed to HoverUp mouse or smtg
IsMouseOver
K
kuulie•401d ago
um, which part of your code am i supposed to be looking at? You're also using ControlTemple.Triggers and I was using Style.Triggers. Am I usign the wrong elements
i made another project simply practice hovering and please tell me what im doing wrong with this code:
<Window.Resources>
<Style TargetType="Button">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="Green"/>
</Trigger>
</Style.Triggers>
</Style>
</Window.Resources>
<Grid>
<Button Content="Button"/>
</Grid>
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
52KMembers
View on DiscordWant results from more Discord servers?
More Postswith or without refso i learned that in c#(or most oop languages) when you create a method that takes an object as a pa✅ .net trying to find non-existent cs files`Error IDE1100 Error reading content of source file 'D:\Dev\C++\Test\TestCS\obj\Debug\net6.0\.❔ WPF - Binding to last child of collectionI have the following setup:
```csharp
public partial class StatusMessageService : ObservableObject
✅ What does WPF want from me?I'm actually so tired of WPF and MVVM and all this contrived fuckin bs you guys
MainWindow control:❔ I apparently have an infinite loop, but I can't fix it to workI've tried a lot of stuff, even a "NewtonJson" fix I saw, but it wouldn't solve the problem because ✅ doing nothingdfg❔ I would appreciate some help.So i have this assignment and in lieu of my grandma who passed this past week i've not had the oppor❔ Discord Bot Service ProblemDoes anyone know how to register that service properly?❔ abstract class vs interface```cs
public interface IFoo
{
protected static string GetFormattedTime() => DateTime✅ Refit / RestLess API SDK StructureHey!
How do I structure an SDK for my API?
Let's say I have 2 resources: Users and Groups.
I coul❔ Best way to display a continually updating list of messages```cs
@inject MerpieClient Client
@inject MerpieHubConnection HubConnection
@inject ILogger<MessageL❔ How can I fix this I keep getting null value in my string variable❔ How do I go from interface to implementation while navigating ASP.NET core code?I saw this youtube video and he seamlessly navigates the source? How can I do this? Thanks.Console Application published as PublishSingleFile the window auto close for few devloper.I have published a .exe file with runtime framework included, and distributed to other developer for