Freelance Project Requests Software Development in C# WPF Asp.Net Core Vba Excel Word SQL-Server EF Linq, UWP Net

WPF, c #: Change background color of an element with hover
How do you program a path element in WPF that is highlighted in color when the mouse moves over?
To do this, you have to assign the events: MouseEnter, MouseLeave to WPF XAML.

<StackPanel Name="pnlPath" MouseEnter="StackPanel_MouseEnter" MouseLeave="StackPanel_MouseLeave" MouseDown="StackPanel_MouseDown" >

In the MouseEnter event, you must assign a background to the element as a color.
When exiting under MouseLeave you can set the background back to zero.

private void StackPanel_MouseEnter(object sender, MouseEventArgs e)
//------------< StackPanel_MouseEnter() >------------
pnlPath.Background = new SolidColorBrush(Color.FromArgb(100,200,200,200));
//------------</ StackPanel_MouseEnter() >------------
private void StackPanel_MouseLeave(object sender, MouseEventArgs e)
//------------< StackPanel_MouseLeave() >------------
pnlPath.Background = null;
//------------</ StackPanel_MouseLeave() >------------
private void StackPanel_MouseDown(object sender, MouseButtonEventArgs e)
//------------< StackPanel_MouseDown() >------------
pnlPath.Background = new SolidColorBrush(Color.FromArgb(250, 200, 200, 200));
//------------</ StackPanel_MouseDown() >------------

In the application, the background color of the Breadcrumb segment, which is being crossed with the mouse, changes.
As soon as you click on a segment, the color becomes even more intense.

Xaml code of a subsegment as UserControl for each part individually loaded

<StackPanel Name="pnlPath" Orientation="Horizontal" Height="26px"
MouseEnter="StackPanel_MouseEnter" MouseLeave="StackPanel_MouseLeave" MouseDown="StackPanel_MouseDown" >
<Label Name="lblPath" Content="Path" VerticalAlignment="Center" ></Label>
<Image Name="imgFolder" Source="/wpf_Browse_Folders;component/_images/imgExpand_Right.png" VerticalAlignment="Center"></Image>

WPF Datagrid: Set Color of Row when it has no Focus
WPF Datagrid: Change the Color of Selected Row
WPF: Change Selected Row Color in DataGrid
WPF: Read SelectedItem from DataGrid with Dynamic As Anonymous Type
WPF: Elements too wide, edge Cut off
Solved: System.InvalidCastException HResult 0x80004002 in Select DataGrid
WPF: Combobox Selected Value
WPF Datagrid: Column is not displayed
WPF: Show video in preview
WPF Webbrowser: Suppress Java Errors or Set WebBrowser to Silent


Contact for Jobs, Project Requests: