8

There are many articles that described how to create a custom shaped window in WPF but none of them (at least I can't find any) described how can build a reusable one such as inheriting from it in other windows.

I have tried to create a ControlTemplate from my custom window. The problem is with the Close button and the MoveDrag() method.

If I wire the event to one of my other controls in ControlTemplate their Parent property is null, so I can not drag or close the window.

Does anyone have any ideas how can I create a reusable custom window template or something?

1
  • I'm somewhat unclear on what you're asking for. Perhaps a minimal code sample would help Commented Jan 23, 2009 at 2:37

2 Answers 2

2

Unfortunately there is no such things as visual inheritance in WPF. (no xaml inheritance to be more specific)

For your specific issue, instead of inheriting, you could create a CustomForm as a template (with a big empty container in the middle), and then create all your other forms as usercontrols that fill that container.

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

Comments

0

The following will return the window object containing the control:

Window.GetWindow(myControl) 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.