With the code that produces the Primary Windows Presentation Foundation (WPF) application or within the code behind
In a separate assembly as a class, such as an executable or DLL used as a class library