Normally, to set style using C#, I write, btn.Style = (Style)FindResource(_styleName); But what to do, if style is defined inside main 'ResourceDictionary', and button is inside some 'UserControl'. Also, we have to write script inside 'UserControl' only.