I have a listBox of color and I want to get the selected color String for example: Red,yellow.
The problem is when I get the selectedItem I need to cast it to System.Windows.Media.Color
to get the name and put it into string
to use it in other case.
Here is the code I used ,Unfortunately I always get this exception
Specified cast is not valid
.
System.Windows.Media.Color colo = (System.Windows.Media.Color)listColor.SelectedItem;
Any help would be so appreciated