TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Anja Simonsen
NA
41
15.7k
Styles with Trigger on IsMouseOver still shows the winfows blue color
Mar 8 2021 4:02 PM
Right now I'm trying to use styles in my very new wpf solution.
I have problems with the Trigger IsMouseOver background color. Even when using another background color it still shows Windows blue on mouse over. Do I have to set another property for the mouse over blue color?
Can anyone tell me, why I can make the style Bold but not cann't change the windows normal blue color on mouseover a button?
I have attached the solution
But here is the code first my app.xaml file
<Application x:Class=
"AnsiBug.App"
xmlns=
"http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x=
"http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local=
"clr-namespace:AnsiBug"
StartupUri=
"MainWindow.xaml"
>
<Application.Resources>
<!--#region Buttons -->
<!--Almindelige knapper-->
<Style TargetType=
"Button"
>
<Setter Property=
"Background"
Value=
"#005b7f"
/>
<Setter Property=
"Foreground"
Value=
"White"
/>
<Setter Property=
"FontFamily"
Value=
"Verdana"
/>
<Setter Property=
"FontSize"
Value=
"12"
/>
<Setter Property=
"Margin"
Value=
"3"
/>
<Setter Property=
"Padding"
Value=
"5 5 5 5"
/>
</Style>
<!--Top Menu knapper-->
<Style TargetType=
"Button"
x:Key=
"TopMenuButton"
>
<Setter Property=
"Background"
Value=
"White"
/>
<Setter Property=
"Foreground"
Value=
"Black"
/>
<Setter Property=
"FontFamily"
Value=
"Verdana"
/>
<Setter Property=
"FontSize"
Value=
"12"
/>
<Setter Property=
"Width"
Value=
"120"
/>
<Setter Property=
"HorizontalAlignment"
Value=
"Left"
/>
<Setter Property=
"HorizontalContentAlignment"
Value=
"Left"
/>
<Setter Property=
"BorderThickness"
Value=
"0"
/>
<Setter Property=
"BorderBrush"
Value=
"Transparent"
/>
<Setter Property=
"Padding"
Value=
"5 0 2 2"
/>
<Style.Triggers>
<Trigger Property=
"IsMouseOver"
Value=
"True"
>
<Setter Property=
"Background"
Value=
"White"
/>
<Setter Property=
"FontWeight"
Value=
"Bold"
/>
</Trigger>
</Style.Triggers>
</Style>
<!--Top SubMenu knapper-->
<Style TargetType=
"Button"
x:Key=
"TopSubMenuButton"
>
<Setter Property=
"Background"
Value=
"#005b7f"
/>
<Setter Property=
"Foreground"
Value=
"White"
/>
<Setter Property=
"FontFamily"
Value=
"Verdana"
/>
<Setter Property=
"FontSize"
Value=
"12"
/>
<Setter Property=
"HorizontalAlignment"
Value=
"Left"
/>
<Setter Property=
"Width"
Value=
"120"
/>
<Setter Property=
"HorizontalContentAlignment"
Value=
"Left"
/>
<Setter Property=
"BorderThickness"
Value=
"0"
/>
<Setter Property=
"BorderBrush"
Value=
"Transparent"
/>
<Setter Property=
"Padding"
Value=
"5 2 2 0"
/>
<Style.Triggers>
<Trigger Property=
"IsMouseOver"
Value=
"True"
>
<Setter Property=
"Background"
Value=
"#005b7f"
/>
<Setter Property=
"FontWeight"
Value=
"Bold"
/>
</Trigger>
</Style.Triggers>
</Style>
<!--#endregion-->
</Application.Resources>
</Application>
And here is my
My MainWindow (the two first images are logos You can put every image you want. The Divider image is included in the solution.
<Window xmlns:syncfusion=
"http://schemas.syncfusion.com/wpf"
x:Name=
"AnsiBug"
x:Class=
"AnsiBug.MainWindow"
xmlns=
"http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x=
"http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d=
"http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc=
"http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local=
"clr-namespace:AnsiBug"
mc:Ignorable=
"d"
Title=
"MainWindow"
Height=
"800"
Width=
"1200"
HorizontalAlignment=
"Center"
VerticalAlignment=
"Center"
WindowStartupLocation=
"CenterScreen"
>
<Window.Resources>
<!--Base Button Style-->
</Window.Resources>
<StackPanel>
<Border BorderBrush=
"Black"
BorderThickness=
"2"
>
<Grid Margin=
"5"
ShowGridLines=
"True"
>
<Grid.ColumnDefinitions>
<ColumnDefinition Width=
"250"
/>
<ColumnDefinition Width=
"*"
/>
<ColumnDefinition Width=
"250"
/>
</Grid.ColumnDefinitions>
<Image Source=
"/Images/Logo/ANSI.gif"
HorizontalAlignment=
"Left"
Width=
"200"
Height=
"80"
Grid.Column=
"0"
Margin=
"0,0,111,125"
/>
<Image Source=
"/Images/Logo/logoBug.gif"
HorizontalAlignment=
"Right"
Width=
"150"
Height=
"80"
Grid.Column=
"2"
Margin=
"158,0,0,149"
/>
<Grid Grid.Column=
"1"
>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width=
"*"
/>
<ColumnDefinition Width=
"*"
/>
<ColumnDefinition Width=
"*"
/>
<ColumnDefinition Width=
"*"
/>
<ColumnDefinition Width=
"*"
/>
<ColumnDefinition Width=
"*"
/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height=
"*"
/>
</Grid.RowDefinitions>
<StackPanel Orientation=
"Vertical"
Grid.Row=
"0"
Grid.Column=
"0"
>
<Button x:Name=
"BtnProjects"
Content=
"Projekter"
Style=
"{StaticResource TopMenuButton}"
/>
<Image Source=
"/Images/TopDivider.jpg"
/>
<StackPanel x:Name=
"ProjectsSubMenu"
>
<Button x:Name=
"BtnDashBoard"
Content=
"Dashboard"
Style=
"{StaticResource TopSubMenuButton}"
/>
<Button x:Name=
"BtnNewBug"
Content=
"Ny fejl"
Style=
"{StaticResource TopSubMenuButton}"
/>
</StackPanel>
</StackPanel>
</Grid>
<!--Række 0 Projekter-->
<!--Række 1-->
<!--Række 2-->
<!--Række 3-->
<!--Række 4-->
<!--Række 5-->
</Grid>
</Grid>
</Border>
<Grid Margin=
"5"
>
<Grid.ColumnDefinitions>
<ColumnDefinition Width=
"*"
/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height=
"*"
/>
</Grid.RowDefinitions>
<TextBlock Text=
"Her kommer anden række"
/>
</Grid>
</StackPanel>
</Window>
Best regards,
Simsen :-)
Attachment:
AnsiBugSolution.zip
Reply
Answers (
2
)
Data not displaying in listview any help urgent
how to find control by name in wpf