0

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?

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

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.
1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.