Im creating a few buttons in code behind.
List<Button> steps = new List<Button>();
Steps.Add(new Button
{
Style = (System.Windows.Style)Application.Current.TryFindResource("WorkflowButtonStyle")
,Content = StepDescription
, Command = WfCommand
, CommandParameter = workflowToFrom
, Width = 206
});
The style always returns as null. I even tried to load a resource dictionary.
Application.Current.Resources.MergedDictionaries.Add(Application.LoadComponent(new Uri("/Resources;component/Dictionaries/FormD.xaml", UriKind.Relative)) as ResourceDictionary);
and still doesnt load the style. The dictionary exists in another project..it works when i reference it in the XAML. But doesnt seem to like it in the code behind. Anybody face the same issue?