Use the style defined in resource dictionary :

Posted by Malcolm on Stack Overflow See other posts from Stack Overflow or by Malcolm
Published on 2010-05-20T10:03:16Z Indexed on 2010/05/20 10:30 UTC
Read the original article Hit count: 178

Filed under:
|
|

I have a style defined for listboxitem in a resource dictionary. I want to use this style in a cs file of listbox :

I am doing the below thing but it gives me null ,CustomListBoxItemStyle is a name of a key given to the style.

public class CustomListBox : ListBox
{  
    public CustomListBox()
    {
        this.ItemContainerStyle = Application.Current.Resources["CustomListBoxItemStyle"] as Style;
    }
}

There is no xaml for this.

How to achieve this?

© Stack Overflow or respective owner

Related posts about silverlight-4.0

Related posts about c#