tags:

views:

41

answers:

1

Sorry... I hope this isnt a really dumb question... but I couldnt find the answer anywhere. I have a WPF application, in each of my usercontrols / windows I am currently putting the following code in xaml in the header...

xmlns:properties="clr-namespace:MaxCut2.Properties"

This particular properties namespace I use in every window / usercontrol in my project and I would have thought that if I had put the code in my App.xaml, it would have been exposed to all the child windows/uc's - but it doesn't seem to work.

Is there a way that I can expose this without having to declare it in every file in XAML?

A: 

If you're certain that the content of your class will never conflict with the standard WPF namespaces, you could use

[assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "MaxCut2.Properties")]

to include your class in the default namespace. But I wouldn't recommend it - as mentioned there's the potential for conflicts and it could make your code harder to maintain.

Ian Gregory
Yeah... I don't think that would be a good idea - I can just see it causing issues down the line. In Winforms one could make a base class and make all the windows inherit from it, but I just cannot think of a way to achieve the same so far... But thanks for the suggestion!
Mark Pearl