Category / Section
How to change the SelectedItem Background and MouseOver Background of CheckListBoxItems ?
1 min read
We can change the background colour of SelectedItem and MouseOver background colour by using SelectedItemBackground property and MouseOverBackground property respectively in our CheckListBox control.
The following example explains about the SelectedItemBackground and MouseOverBackground properties.
XAML
<syncfusion:CheckListBox x:Name="checkListBox" SelectedItemBackground="Red" MouseOverBackground="BlueViolet" > <syncfusion:CheckListBoxItem>WPF</syncfusion:CheckListBoxItem> <syncfusion:CheckListBoxItem>WindowsPhone</syncfusion:CheckListBoxItem> <syncfusion:CheckListBoxItem>WinRT</syncfusion:CheckListBoxItem> <syncfusion:CheckListBoxItem>WindowsForm</syncfusion:CheckListBoxItem> <syncfusion:CheckListBoxItem>SilverLight</syncfusion:CheckListBoxItem> <syncfusion:CheckListBoxItem>IOS</syncfusion:CheckListBoxItem> </syncfusion:CheckListBox>
C#
checkListBox.SelectedItemBackground = new SolidColorBrush(Colors.Red); checkListBox.MouseOverBackground = new SolidColorBrush(Colors.BlueViolet);
The output for the above code is shown below:
SelectedItemBackground = Red and MouseOverBackground = BlueViolet