tags:

views:

220

answers:

2

My current project creates UI by WPF at runtime. Everything works well. The only issue about it is that the global WPF template is ignored for some reason.

We created a skin that is attached to the main form and thus used by all xaml created UI elements.

My own code just dynamically creates items like this:

var textBox = new TextBox();
parentControl.Controls.Add(textBox);

How can I accomplish this?

+1  A: 

I am assuming you mean the look & feel for something is being ignored. Could you be more specific?

Usually, if the default style/template for an element if "ignored" it means that you are doing something to override the defaults.

siz
+2  A: 

If your skins are added to the resource dictionary of your main window, the child window will not be able to see the skins. You need to move the skins to App.xaml.

Jakob Christensen
This is the correct. Another approach might be to add the parent Window's Resource dictionary into the child window's resource dictionary's MergedDictionaries collection.
Phil Price