views:

19

answers:

1

When I'm applying a Style to a ListBox.ItemContainerStyle in C# it isn't making the change at runtime.

I'm using;

myListBox.ItemContainerStyle = (Style)(App.Current.Resources["NewItemStyle"]);

However all other styles are being supplied, such as Buttons etc where I'm going myButton.Style = (Style)(App.Current.Resources["myMainButtonStyle"]);

I don't get any errors either, it just does nothing and reverts to the default system style.

A: 

I was using App.Current.Resources instead of just Resources because "NewItemStyle" wasn't defined in the whole application. My mistake.

turtlepower