Skip to main content

All Questions

Tagged with
0 votes
0 answers
678 views

WinUI 3, Button Style Error: The attachable property 'Triggers' was not found in type 'Style'

I am developing a WinUI 3 C# app and have this XAML snippet: <Style TargetType="AppBarButton" x:Key="VolumeButtonStyle"> <Setter Property="Background" Value=&...
��ωνσταντίνος Κ.'s user avatar
-1 votes
1 answer
49 views

C# WPF Buttonproperties when mouse hovers or clicks it

I'm trying to make my button theme react to the mouse. So when I hover over the button it should be gray and when I click it, the button should change the color as well. If tried to write my own code ...
Biswind's user avatar
  • 25
0 votes
2 answers
635 views

Button's trigger IsMouseOver stops working after button's background is set in code-behind

I want the background of a button to change when the cursor hovers over the button. I have managed to do this in a style which use the "IsMouseOver" trigger which sets the button's ...
Mc_Topaz's user avatar
  • 647
0 votes
0 answers
46 views

How to trigger Button C# [duplicate]

This is the terms form code: When form pops up there is one choice that accept button; How can i click accept from the source code I just know i need to use somethıng like trigger but how? If you ...
Joshua King's user avatar
0 votes
1 answer
742 views

WPF IsPressed trigger going away when mouse leaves button

I've got a WPF button with a ControlTemplate including a trigger on the IsPressed property (snippet shown below). The button is a "press and hold" type of button, so while the button is pressed down I ...
Kurt Madland's user avatar
0 votes
1 answer
325 views

Mouse Hover trigger not working after changing background color programmatically

I have a project where I introduced a trigger for a button that changed the background color of the button when the mouse hovers it. This is what it looks like: <Window.Resources> <...
user avatar
-3 votes
2 answers
70 views

Declaration without state

Hello I have simple code and would like to have one button control of label: private void button1_Click(object sender, EventArgs e) { bool T=true; if (T) { label1....
Klasik's user avatar
  • 892
0 votes
3 answers
119 views

Changing Border of Button when pressed

I got this style for my button already: <Style x:Key="ControlButtons"> <Setter Property="Button.Height" Value="25" /> <Setter Property="Button.Width" Value="60" /> <...
Flo's user avatar
  • 335
1 vote
0 answers
55 views

Trigger wont work for my Borderbrush

** First i had a problem of changing background when IsMouseOver, but i fixed it lated and now my trigger for borderbrush wont work when IsAnabled="False" but Background and ...
A.Game's user avatar
  • 49
0 votes
1 answer
66 views

Bind ControlTemplateTrigger to TextBlock property

I am trying to change the TextBlock text colour whenever the Button is highlighted. However, I don't know how to bind the ControlTemplate.Trigger to the TextBlock Foreground. I tried giving the ...
user avatar
0 votes
1 answer
183 views

Strange button style behaviour, changing colors like storyboard

I want to style a button depending on a ViewModel property, which is not part of the button. So I created the following The Button XAML: <Button Content="DisableButton" Height="27" ...
Mare Infinitus's user avatar
0 votes
1 answer
279 views

Change Label content with IsMouseOver on checkbox

Hei, Im creating a button what has a checkbox on top of it. Now when user hovers over the checkbox with a mouse i would like to change the text on the button. Here's what i have currently: <...
hs2d's user avatar
  • 6,209
7 votes
1 answer
13k views

Button IsEnabled Trigger does not work

I have a Button and its Style: <Button Name="MyBtn" Style="{StaticResource ButtonEnabledStyle}" IsEnabled="False" Opacity="1" /> <Style x:Key="ButtonEnabledStyle" TargetType="Button"...
Nick's user avatar
  • 10.5k
0 votes
2 answers
1k views

How do I change the entire style of a button from code behind in realtime?

I have a button that flashes. I would like to change the entire button style from a resource dictionary when ever it flashes. I would think it would be like this: DesktopWindow.AlertButton.Style = (...
n644dc's user avatar
  • 13
5 votes
1 answer
26k views

How to change the button color onmoveover,onmouseleave in wpf by using triggers or any other events

I have developed a WPF Application with some buttons. Now i want to change the color of those buttons onmouseover,onmouseleave,onmouseenter by using triggers or any other events. Any suggestion plz ...
ibrahimkhan's user avatar