Category / Section
How to set MouseOverBackgroundColor for the SfRadialMenuItem?
1 min read
MouseOverBackground color of SfRadialMenuItem can be changed by MenuMouseOverBackground property. To enable the background color, ShowMouseOverStyle property of SfRadialMenuItem need to set to True. The same has been explained in the following code example:
XAML:
<Window x:Class="SfRadialMenuItem_New.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:navigation="clr-namespace:Syncfusion.Windows.Controls.Navigation;assembly=Syncfusion.SfRadialMenu.Wpf" Title="MainWindow" Height="350" Width="525"> <Grid x:Name="Grid1"> <navigation:SfRadialMenu x:Name="_Radialmenu"> <navigation:SfRadialMenuItem Header="MenuItem1" ShowMouseOverStyle="True" MenuMouseOverBackgroundColor="Red" /> <navigation:SfRadialMenuItem Header="MenuItem2" ShowMouseOverStyle="True" MenuMouseOverBackgroundColor="Yellow" /> <navigation:SfRadialMenuItem Header="MenuItem3" ShowMouseOverStyle="True" MenuMouseOverBackgroundColor="Green" /> <navigation:SfRadialMenuItem Header="MenuItem4" ShowMouseOverStyle="True" MenuMouseOverBackgroundColor="Brown"/> <navigation:SfRadialMenuItem Header="MenuItem5" ShowMouseOverStyle="True" MenuMouseOverBackgroundColor="BlueViolet" /> </navigation:SfRadialMenu> </Grid> </Window>
C#:
namespace SfRadialMenuItem_New { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); SfRadialMenu _Radialmenu = new SfRadialMenu(); SfRadialMenuItem Item1 = new SfRadialMenuItem(); Item1.Header = "MenuItem1"; Item1.ShowMouseOverStyle = true; Item1.MenuMouseOverBackgroundColor = Brushes.Red; SfRadialMenuItem Item2 = new SfRadialMenuItem(); Item2.Header = "MenuItem2"; Item2.ShowMouseOverStyle = true; Item2.MenuMouseOverBackgroundColor = Brushes.Yellow; SfRadialMenuItem Item3 = new SfRadialMenuItem(); Item3.Header = "MenuItem3"; Item3.ShowMouseOverStyle = true; Item3.MenuMouseOverBackgroundColor = Brushes.Green; SfRadialMenuItem Item4 = new SfRadialMenuItem(); Item4.Header = "MenuItem4"; Item4.ShowMouseOverStyle = true; Item4.MenuMouseOverBackgroundColor = Brushes.Brown; SfRadialMenuItem Item5 = new SfRadialMenuItem(); Item5.Header = "MenuItem5"; Item5.ShowMouseOverStyle = true; Item5.MenuMouseOverBackgroundColor = Brushes.BlueViolet; _Radialmenu.Items.Add(Item1); _Radialmenu.Items.Add(Item2); _Radialmenu.Items.Add(Item3); _Radialmenu.Items.Add(Item4); _Radialmenu.Items.Add(Item5); Grid1.Children.Add(_Radialmenu); } } }
Output: