knightsbore
knightsbore

Reputation: 480

XAML Listbox background formatting Silverlight

OK so i am passing an Observable collection to the itemsource of a listbox the collection has a color property, and i had been doing the background color within the grid inside the listbox by binding the color. However I need to have the item change color when the mousover event occurs, which doesn't show because the background drawn to the grid overlays the color change on the listboxItem. When I try and bind the color to the listboxitem however it throws an exception.

I could really use some help here I've tried everything i can think of and find.

Upvotes: 0

Views: 251

Answers (2)

knightsbore
knightsbore

Reputation: 480

I found the solution, it turns out this is one of the limitations in Silverlight that is known to the silverlight team, a blog post at http://blogs.msdn.com/b/delay/archive/2009/11/02/as-the-platform-evolves-so-do-the-workarounds-better-settervaluebindinghelper-makes-silverlight-setters-better-er.aspx demonstrates a method to force a binding on a control.

Upvotes: 1

yapingchen
yapingchen

Reputation: 856

you can write the mouseenter and mouseleave events ,in the mouseenter, you remove the grid backagegroud color and add the item's backagegourd's color. in the mouseleave you remove the item's backagegroud's color and add the grid's backagegroud's color

Upvotes: 0

Related Questions